update vendor keybase/go-crypto (#10234)
This commit is contained in:
parent
86fdba177a
commit
bfd62b6f01
29 changed files with 1062 additions and 769 deletions
7
vendor/github.com/keybase/go-crypto/openpgp/packet/encrypted_key.go
generated
vendored
7
vendor/github.com/keybase/go-crypto/openpgp/packet/encrypted_key.go
generated
vendored
|
@ -83,6 +83,10 @@ func checksumKeyMaterial(key []byte) uint16 {
|
|||
// private key must have been decrypted first.
|
||||
// If config is nil, sensible defaults will be used.
|
||||
func (e *EncryptedKey) Decrypt(priv *PrivateKey, config *Config) error {
|
||||
if priv == nil || priv.PrivateKey == nil {
|
||||
return errors.InvalidArgumentError("attempting to decrypt with nil PrivateKey")
|
||||
}
|
||||
|
||||
var err error
|
||||
var b []byte
|
||||
|
||||
|
@ -90,7 +94,8 @@ func (e *EncryptedKey) Decrypt(priv *PrivateKey, config *Config) error {
|
|||
// padding oracle attacks.
|
||||
switch priv.PubKeyAlgo {
|
||||
case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly:
|
||||
b, err = rsa.DecryptPKCS1v15(config.Random(), priv.PrivateKey.(*rsa.PrivateKey), e.encryptedMPI1.bytes)
|
||||
k := priv.PrivateKey.(*rsa.PrivateKey)
|
||||
b, err = rsa.DecryptPKCS1v15(config.Random(), k, padToKeySize(&k.PublicKey, e.encryptedMPI1.bytes))
|
||||
case PubKeyAlgoElGamal:
|
||||
c1 := new(big.Int).SetBytes(e.encryptedMPI1.bytes)
|
||||
c2 := new(big.Int).SetBytes(e.encryptedMPI2.bytes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue