Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrUnsupportedCurve = errors.New("unsupported curve")
)
Functions ¶
func GenerateNewKeyPair ¶
func GenerateNewKeyPair() (PrivateKey, PublicKey, error)
func MarshalPrivateKey ¶
func MarshalPrivateKey(key PrivateKey) ([]byte, error)
func MarshalPublicKey ¶
Types ¶
type ECDSAPrivateKey ¶
type ECDSAPrivateKey struct {
// contains filtered or unexported fields
}
ECDSAPrivateKey is the ECDSA private key that implements crypto/PrivateKey
func (ECDSAPrivateKey) GetCurve ¶
func (privateKey ECDSAPrivateKey) GetCurve() proto.KeyCurve
GetCurve returns the curve for this key
func (ECDSAPrivateKey) GetPublic ¶
func (privateKey ECDSAPrivateKey) GetPublic() (PublicKey, error)
GetPublic returns the public key component associated with this key.
func (ECDSAPrivateKey) Sign ¶
func (privateKey ECDSAPrivateKey) Sign(data []byte) ([]byte, error)
Sign Hashes this data and signs it.
func (ECDSAPrivateKey) ToBytes ¶
func (privateKey ECDSAPrivateKey) ToBytes() ([]byte, error)
ToBytes serializes this key
type ECDSAPublicKey ¶
type ECDSAPublicKey struct {
// contains filtered or unexported fields
}
ECDSAPublicKey is the ECDSA public key that implements crypto/PublicKey
func (ECDSAPublicKey) GetCurve ¶
func (publicKey ECDSAPublicKey) GetCurve() proto.KeyCurve
GetCurve returns the curve for this key
func (*ECDSAPublicKey) ToBytes ¶
func (publicKey *ECDSAPublicKey) ToBytes() ([]byte, error)
ToBytes serializes this key
func (*ECDSAPublicKey) VerifySignature ¶
func (publicKey *ECDSAPublicKey) VerifySignature(data []byte, sig []byte) (bool, error)
VerifySignature hashes the data and verifies the signature.
type PrivateKey ¶
type PrivateKey interface { // GetCurve returns the Key curve for this key GetCurve() proto.KeyCurve // ToBytes Serializes the key ToBytes() ([]byte, error) // Sign signs the data Sign(data []byte) ([]byte, error) // GetPublic returns the public component of this key GetPublic() (PublicKey, error) }
PrivateKey is the Private key type
func EcdsaPrivateKeyFromRawBytes ¶
func EcdsaPrivateKeyFromRawBytes(bytes []byte) (PrivateKey, error)
EcdsaPrivateKeyFromRawBytes - from raw bytes, assembles a private key
func UnMarshallPrivateKey ¶
func UnMarshallPrivateKey(b []byte) (PrivateKey, error)
type PublicKey ¶
type PublicKey interface { // GetCurve returns the Key curve for this key GetCurve() proto.KeyCurve // ToBytes Serializes the key ToBytes() ([]byte, error) // VerifySignature verifies whether the data was signed // by this key's private counterpart. VerifySignature(data []byte, sig []byte) (bool, error) }
PublicKey is the Public key type
func PubKeyFromRawBytes ¶
PubKeyFromRawBytes - Bytes to PublicKey
func UnMarshallPublicKey ¶
Click to show internal directories.
Click to hide internal directories.