Add support for the crypto refresh in v2 (#265)
This commit adds support for the OpenPGP crypto-refresh. - Updates go-crypto dependency to v1.1.0-alpha.1 - Adapts the session key logic to handle PKESK/SKESK v6 packets without an algorithm attached - Updates the min go version to 1.17 as requires by go-crypto v1.1.0-alpha.1 - Update the cricl dependency to 1.3.7 matching go-crypto Not supported: - crypto-refresh intended recipients - v6 key generation
This commit is contained in:
parent
c6a3058e2e
commit
453e81905b
9 changed files with 92 additions and 29 deletions
|
|
@ -8,8 +8,12 @@ import (
|
|||
|
||||
"github.com/ProtonMail/go-crypto/openpgp/ecdh"
|
||||
"github.com/ProtonMail/go-crypto/openpgp/ecdsa"
|
||||
"github.com/ProtonMail/go-crypto/openpgp/ed25519"
|
||||
"github.com/ProtonMail/go-crypto/openpgp/ed448"
|
||||
"github.com/ProtonMail/go-crypto/openpgp/eddsa"
|
||||
"github.com/ProtonMail/go-crypto/openpgp/elgamal"
|
||||
"github.com/ProtonMail/go-crypto/openpgp/x25519"
|
||||
"github.com/ProtonMail/go-crypto/openpgp/x448"
|
||||
)
|
||||
|
||||
func (sk *SessionKey) Clear() (ok bool) {
|
||||
|
|
@ -61,6 +65,14 @@ func clearPrivateKey(privateKey interface{}) error {
|
|||
return clearEdDSAPrivateKey(priv)
|
||||
case *ecdh.PrivateKey:
|
||||
return clearECDHPrivateKey(priv)
|
||||
case *x25519.PrivateKey:
|
||||
return clearX25519PrivateKey(priv)
|
||||
case *ed25519.PrivateKey:
|
||||
return clearEd25519PrivateKey(priv)
|
||||
case *x448.PrivateKey:
|
||||
return clearX448PrivateKey(priv)
|
||||
case *ed448.PrivateKey:
|
||||
return clearEd448PrivateKey(priv)
|
||||
default:
|
||||
return errors.New("gopenpgp: unknown private key")
|
||||
}
|
||||
|
|
@ -126,3 +138,27 @@ func clearECDHPrivateKey(priv *ecdh.PrivateKey) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func clearX25519PrivateKey(priv *x25519.PrivateKey) error {
|
||||
clearMem(priv.Secret)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func clearEd25519PrivateKey(priv *ed25519.PrivateKey) error {
|
||||
clearMem(priv.Key[:ed25519.SeedSize])
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func clearX448PrivateKey(priv *x448.PrivateKey) error {
|
||||
clearMem(priv.Secret)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func clearEd448PrivateKey(priv *ed448.PrivateKey) error {
|
||||
clearMem(priv.Key[:ed448.SeedSize])
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue