new helpers for drive decryption (#73)

* new helpers for drive decryption

* modular helper functions and reciprocals

* removed duplicates helper functions

* added mobile wrapper

* unit tests for new helpers

Co-authored-by: wussler <aron@wussler.it>
This commit is contained in:
marinthiercelin 2020-08-27 17:34:46 +02:00 committed by GitHub
parent af371097e0
commit 39c2fa863e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 231 additions and 38 deletions

View file

@ -79,3 +79,20 @@ func GetJsonSHA256Fingerprints(publicKey string) ([]byte, error) {
return json.Marshal(key.GetSHA256Fingerprints())
}
type EncryptSignArmoredDetachedMobileResult struct {
Ciphertext, Signature string
}
//EncryptSignArmoredDetachedMobile wraps the EncryptSignArmoredDetached method
//to have only one return argument for mobile.
func EncryptSignArmoredDetachedMobile(
publicKey, privateKey string,
passphrase, plainData []byte,
) (wrappedTuple *EncryptSignArmoredDetachedMobileResult, err error) {
ciphertext, signature, err := EncryptSignArmoredDetached(publicKey, privateKey, passphrase, plainData)
if err != nil {
return nil, err
}
return &EncryptSignArmoredDetachedMobileResult{ciphertext, signature}, nil
}