fix rsa type
This commit is contained in:
parent
532ce66247
commit
9b75197da8
1 changed files with 3 additions and 2 deletions
|
|
@ -16,6 +16,7 @@ import (
|
||||||
"golang.org/x/crypto/openpgp/armor"
|
"golang.org/x/crypto/openpgp/armor"
|
||||||
pgperrors "golang.org/x/crypto/openpgp/errors"
|
pgperrors "golang.org/x/crypto/openpgp/errors"
|
||||||
"golang.org/x/crypto/openpgp/packet"
|
"golang.org/x/crypto/openpgp/packet"
|
||||||
|
xrsa "golang.org/x/crypto/rsa"
|
||||||
|
|
||||||
armorUtils "github.com/ProtonMail/go-pm-crypto/armor"
|
armorUtils "github.com/ProtonMail/go-pm-crypto/armor"
|
||||||
"github.com/ProtonMail/go-pm-crypto/constants"
|
"github.com/ProtonMail/go-pm-crypto/constants"
|
||||||
|
|
@ -503,7 +504,7 @@ func (kr *KeyRing) readFrom(r io.Reader, armored bool) error {
|
||||||
switch entity.PrivateKey.PrivateKey.(type) {
|
switch entity.PrivateKey.PrivateKey.(type) {
|
||||||
// TODO: type mismatch after crypto lib update, fix this:
|
// TODO: type mismatch after crypto lib update, fix this:
|
||||||
case *rsa.PrivateKey:
|
case *rsa.PrivateKey:
|
||||||
entity.PrimaryKey = packet.NewRSAPublicKey(time.Now(), entity.PrivateKey.PrivateKey.(*rsa.PrivateKey).Public().(*rsa.PublicKey))
|
entity.PrimaryKey = packet.NewRSAPublicKey(time.Now(), entity.PrivateKey.PrivateKey.(*rsa.PrivateKey).Public().(*xrsa.PublicKey))
|
||||||
case *ecdsa.PrivateKey:
|
case *ecdsa.PrivateKey:
|
||||||
entity.PrimaryKey = packet.NewECDSAPublicKey(time.Now(), entity.PrivateKey.PrivateKey.(*ecdsa.PrivateKey).Public().(*ecdsa.PublicKey))
|
entity.PrimaryKey = packet.NewECDSAPublicKey(time.Now(), entity.PrivateKey.PrivateKey.(*ecdsa.PrivateKey).Public().(*ecdsa.PublicKey))
|
||||||
}
|
}
|
||||||
|
|
@ -512,7 +513,7 @@ func (kr *KeyRing) readFrom(r io.Reader, armored bool) error {
|
||||||
if subkey.PrivateKey != nil {
|
if subkey.PrivateKey != nil {
|
||||||
switch subkey.PrivateKey.PrivateKey.(type) {
|
switch subkey.PrivateKey.PrivateKey.(type) {
|
||||||
case *rsa.PrivateKey:
|
case *rsa.PrivateKey:
|
||||||
subkey.PublicKey = packet.NewRSAPublicKey(time.Now(), subkey.PrivateKey.PrivateKey.(*rsa.PrivateKey).Public().(*rsa.PublicKey))
|
subkey.PublicKey = packet.NewRSAPublicKey(time.Now(), subkey.PrivateKey.PrivateKey.(*rsa.PrivateKey).Public().(*xrsa.PublicKey))
|
||||||
case *ecdsa.PrivateKey:
|
case *ecdsa.PrivateKey:
|
||||||
subkey.PublicKey = packet.NewECDSAPublicKey(time.Now(), subkey.PrivateKey.PrivateKey.(*ecdsa.PrivateKey).Public().(*ecdsa.PublicKey))
|
subkey.PublicKey = packet.NewECDSAPublicKey(time.Now(), subkey.PrivateKey.PrivateKey.(*ecdsa.PrivateKey).Public().(*ecdsa.PublicKey))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue