diff --git a/VERSION b/VERSION index cbb488ee2..00de776e1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.45.12 +0.45.14 diff --git a/pkg/wallet/private_key.go b/pkg/wallet/private_key.go index 42ba4e483..ff05bb8e6 100644 --- a/pkg/wallet/private_key.go +++ b/pkg/wallet/private_key.go @@ -6,6 +6,7 @@ import ( "crypto/elliptic" "crypto/rand" "crypto/sha256" + "crypto/x509" "encoding/hex" "errors" "fmt" @@ -57,6 +58,15 @@ func NewPrivateKeyFromBytes(b []byte) (*PrivateKey, error) { return &PrivateKey{b}, nil } +// NewPrivateKeyFromRawBytes returns a NEO PrivateKey from the ASN.1 serialized keys. +func NewPrivateKeyFromRawBytes(b []byte) (*PrivateKey, error) { + privkey, err := x509.ParseECPrivateKey(b) + if err != nil { + return nil, err + } + return NewPrivateKeyFromBytes(privkey.D.Bytes()) +} + // PublicKey derives the public key from the private key. func (p *PrivateKey) PublicKey() ([]byte, error) { var (