diff options
| author | Shulhan <ms@kilabit.info> | 2023-10-06 11:10:17 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-10-06 11:10:17 +0700 |
| commit | f364f10b8c5c71954d4ceb572cf3b18a61f077e0 (patch) | |
| tree | 0f2dbbeabc0a7937af1d2650ed056d5f7c7962be | |
| parent | 8a1a81a6428ae970569d9c2a506acf90deb2e0c4 (diff) | |
| download | gotp-f364f10b8c5c71954d4ceb572cf3b18a61f077e0.tar.xz | |
all: replace encrypt and decryption functions from "lib/crypto"
The "lib/crypto" DecryptAoep and EncryptAoep support large message.
| -rw-r--r-- | issuer.go | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -12,6 +12,7 @@ import ( "strconv" "strings" + libcrypto "github.com/shuLhan/share/lib/crypto" "github.com/shuLhan/share/lib/ini" "github.com/shuLhan/share/lib/totp" ) @@ -44,7 +45,7 @@ func NewIssuer(label, rawConfig string, rsaPrivateKey *rsa.PrivateKey) (issuer * return nil, fmt.Errorf(`%s: %w`, logp, err) } - vbytes, err = rsa.DecryptOAEP(sha256.New(), rand.Reader, rsaPrivateKey, vbytes, nil) + vbytes, err = libcrypto.DecryptOaep(sha256.New(), rand.Reader, rsaPrivateKey, vbytes, nil) if err != nil { return nil, fmt.Errorf(`%s: %w`, logp, err) } @@ -104,7 +105,7 @@ func (issuer *Issuer) pack(privateKey *rsa.PrivateKey) (value string, err error) return string(issuer.raw), nil } - issuer.raw, err = rsa.EncryptOAEP(sha256.New(), rng, &privateKey.PublicKey, issuer.raw, nil) + issuer.raw, err = libcrypto.EncryptOaep(sha256.New(), rng, &privateKey.PublicKey, issuer.raw, nil) if err != nil { return ``, fmt.Errorf(`%s: %w`, logp, err) } |
