Send private key in gpg mail
Changing the original string causes some very weird issues. When I run it, it seems to partially work, but only outputs some of the characters of the original string. Md, _ := openpgp.ReadMessage(bytes.NewBuffer(dec), entitylist2, nil, nil)īytess, _ := ioutil.ReadAll(md.UnverifiedBody) Decrypt it with the contents of the private key Log.Printf("Finished decrypting private key using passphrase")ĭec, _ := (encstr) Log.Printf("Decrypting private key using passphrase")Į(passphrasebyte) Have not touched the encrypted string yet Get the passphrase and read the private key. KeyringFileBuffer2, _ := os.Open(secretKeyring)Įntitylist2, _ = openpgp.ReadKeyRing(keyringFileBuffer2) but we'll just decrypt it in the same code Here is where I would transfer the encrypted string to someone else W, _ := openpgp.Encrypt(buf, entitylist, nil, nil, nil)Įncstr := (bytesp) KeyringFileBuffer, _ := os.Open(publicKeyring)Įntitylist, _ := openpgp.ReadKeyRing(keyringFileBuffer) Log.Printf("Public Keyring: ", publicKeyring) Log.Printf("Secret Keyring: ", secretKeyring) ensure you correct paths and passphraseĬonst mysecretstring = "this is so very secret!"Ĭonst secretKeyring = "/Users/stuart-warren/.gnupg/secring.gpg"Ĭonst publicKeyring = "/Users/stuart-warren/.gnupg/pubring.gpg" Here is what I have so far: ( ) package main So I'm pretty new to golang and i'm struggling to get a working example going of encrypting some text with openpgp and decrypting it again.
#Send private key in gpg mail how to#
Tx = build_transaction(prev_tx, prev_out_index, key, tx_value, address, "hello")ĭoes anyone know how to solve this error? Prev_tx = prev_tx(previous_tx, "testnet3") Key = Bitcoin::Key.new(priv_key, publ_key)
Plaintext = decrypt_rsa(message, privKey) Return rsa.verify(msg.encode('utf-16'), signature, key) = 'SHA-1' Return rsa.decrypt(ciphertext, key).decode('utf-16') Return rsa.encrypt(msg.encode('utf-16'), key)
With open('E:/workstation/projects/amon/cryptoPATH/keys/privkey.pem', 'rb') as f: With open('E:/workstation/projects/amon/cryptoPATH/keys/pubkey.pem', 'rb') as f: With open('keys/privkey.pem', 'wb') as f: Token = ''.join(secrets.choice(alphabet) for i in range(64))
#Send private key in gpg mail full#
I need some help on it and this is the full source code import secretsĪlphabet = string.ascii_letters + string.digits I'm trying to find a way either to convert bytes to string and store it in db or store it as bytes as it is but I couldn't find either of them I'm trying to encrypt string with python by RSA but the encrypted string returns as bytes