diff options
| author | Shulhan <ms@kilabit.info> | 2023-09-20 23:08:01 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-09-20 23:08:01 +0700 |
| commit | c059dcca2a54919a1111bc1a2b286e11b4fc4d36 (patch) | |
| tree | b721a8c6a301532f746b2b064d6978b886e2203f /awwan.go | |
| parent | 1307df8af1926698819bc593e0aed91e57ff68d2 (diff) | |
| download | awwan-c059dcca2a54919a1111bc1a2b286e11b4fc4d36.tar.xz | |
all: replace rsa.Decrypt/EncryptOAEP with libcrypto.Decrypt/EncryptOaep
The rsa.EncryptAOEP function has a maximum message size that they can
encrypt (public key size - 2*hash.Size - 2).
To fix this limitation we replace them with the one in libcrypto
that extend the functions to allow encrypting and decrypting a larger
message.
Diffstat (limited to 'awwan.go')
| -rw-r--r-- | awwan.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -145,7 +145,7 @@ func (aww *Awwan) Decrypt(fileVault string) (filePlain string, err error) { plaintext []byte ) - plaintext, err = rsa.DecryptOAEP(hash, rand.Reader, aww.privateKey, ciphertext, label) + plaintext, err = libcrypto.DecryptOaep(hash, rand.Reader, aww.privateKey, ciphertext, label) if err != nil { return ``, fmt.Errorf(`%s: %w`, logp, err) } @@ -190,7 +190,7 @@ func (aww *Awwan) Encrypt(file string) (err error) { ciphertext []byte ) - ciphertext, err = rsa.EncryptOAEP(hash, rand.Reader, &aww.privateKey.PublicKey, src, label) + ciphertext, err = libcrypto.EncryptOaep(hash, rand.Reader, &aww.privateKey.PublicKey, src, label) if err != nil { return fmt.Errorf(`%s: %w`, logp, err) } |
