mirror of
https://github.com/go-gitea/gitea
synced 2025-07-07 02:57:20 +00:00
update vendor keybase/go-crypto (#10234)
This commit is contained in:
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)
|
||||
|
Reference in New Issue
Block a user