Add binary message helpers (#61)
* Add EncryptBinaryMessageArmored helper function to generate an armored PGP message given binary data and an armored public key * Add DecryptBinaryMessageArmored helper function to decrypt armored PGP message into binary data * Streamline the code and fix naming pattern + tests
This commit is contained in:
parent
88da5d44b1
commit
3b2e53c586
3 changed files with 119 additions and 49 deletions
10
README.md
10
README.md
|
|
@ -148,11 +148,17 @@ const privkey = `-----BEGIN PGP PRIVATE KEY BLOCK-----
|
|||
|
||||
const passphrase = []byte(`the passphrase of the private key`) // Passphrase of the privKey
|
||||
|
||||
// encrypt message using public key
|
||||
// encrypt plain text message using public key
|
||||
armor, err := helper.EncryptMessageArmored(pubkey, "plain text")
|
||||
|
||||
// decrypt armored encrypted message using the private key
|
||||
// encrypt binary message using public key
|
||||
armor, err := helper.EncryptBinaryMessageArmored(pubkey, []byte("plain text"))
|
||||
|
||||
// decrypt armored encrypted message using the private key and got plain text
|
||||
decrypted, err := helper.DecryptMessageArmored(privkey, passphrase, armor)
|
||||
|
||||
// decrypt armored encrypted message using the private key and got binary
|
||||
decrypted, err := helper.DecryptBinaryMessageArmored(privkey, passphrase, armor)
|
||||
```
|
||||
|
||||
With signatures:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue