Added helpers with encrypted signatures and unarmored binary ciphertexts (#83)

* added signcryption for binary ciphertexts

* fixing merge issues

* removed newlines before error handling

Co-authored-by: marin thiercelin <marin.thiercelin@pm.me>
This commit is contained in:
marinthiercelin 2020-10-29 06:20:39 -07:00 committed by GitHub
parent 53a85837e0
commit 062cca9201
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 268 additions and 76 deletions

View file

@ -84,10 +84,10 @@ func GetJsonSHA256Fingerprints(publicKey string) ([]byte, error) {
}
type EncryptSignArmoredDetachedMobileResult struct {
Ciphertext, EncryptedSignature string
CiphertextArmored, EncryptedSignatureArmored string
}
// EncryptSignArmoredDetachedMobile wraps the EncryptSignArmoredDetached method
// EncryptSignArmoredDetachedMobile wraps the encryptSignArmoredDetached method
// to have only one return argument for mobile.
func EncryptSignArmoredDetachedMobile(
publicKey, privateKey string,
@ -99,7 +99,28 @@ func EncryptSignArmoredDetachedMobile(
}
return &EncryptSignArmoredDetachedMobileResult{
Ciphertext: ciphertext,
EncryptedSignature: encryptedSignature,
CiphertextArmored: ciphertext,
EncryptedSignatureArmored: encryptedSignature,
}, nil
}
type EncryptSignBinaryDetachedMobileResult struct {
EncryptedData []byte
EncryptedSignatureArmored string
}
// EncryptSignBinaryDetachedMobile wraps the encryptSignBinaryDetached method
// to have only one return argument for mobile.
func EncryptSignBinaryDetachedMobile(
publicKey, privateKey string,
passphrase, plainData []byte,
) (wrappedTuple *EncryptSignBinaryDetachedMobileResult, err error) {
ciphertext, encryptedSignature, err := encryptSignBinaryDetached(publicKey, privateKey, passphrase, plainData)
if err != nil {
return nil, err
}
return &EncryptSignBinaryDetachedMobileResult{
EncryptedData: ciphertext,
EncryptedSignatureArmored: encryptedSignature,
}, nil
}