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:
parent
53a85837e0
commit
062cca9201
4 changed files with 268 additions and 76 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue