Add Public() method
This commit is contained in:
@@ -2,6 +2,7 @@ package crypto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"crypto"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/sha512"
|
"crypto/sha512"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
@@ -45,6 +46,12 @@ func (priv *PrivateKey) Seed() []byte {
|
|||||||
return seed[:]
|
return seed[:]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (priv *PrivateKey) Public() crypto.PublicKey {
|
||||||
|
p := &PublicKey{}
|
||||||
|
newPublicKey(p, priv.pub[:])
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
func (priv *PrivateKey) PublicKey() []byte {
|
func (priv *PrivateKey) PublicKey() []byte {
|
||||||
pub := priv.pub
|
pub := priv.pub
|
||||||
return pub[:]
|
return pub[:]
|
||||||
@@ -412,3 +419,5 @@ func verifyWithDom(pub *PublicKey, message, sig []byte, domPrefix, context strin
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ crypto.PrivateKey = (*PrivateKey)(nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user