Documentation ¶
Index ¶
- func UnmarshalPublic(publicKeyStr string) (ecdsa.PublicKey, error)
- func UnmarshalPublicCustomCurve(curve elliptic.Curve, publicKeyStr string) (ecdsa.PublicKey, error)
- type KeyPair
- func (kp *KeyPair) GenerateSecret(anotherPublicKey ecdsa.PublicKey) (*SharedSecret, error)
- func (kp *KeyPair) Marshal() (privateKey, publicKey string)
- func (kp *KeyPair) PrivateKey() *ecdsa.PrivateKey
- func (kp *KeyPair) PublicKey() ecdsa.PublicKey
- func (kp *KeyPair) Sign() (string, string, string, error)
- func (kp *KeyPair) SignCustomCache(hash []byte) (string, string, error)
- func (kp *KeyPair) Verify(R, S, hash, publicKeyStr string) (bool, error)
- func (kp *KeyPair) VerifyCustomPublic(rStr, sStr, hash string, publicKey ecdsa.PublicKey) (bool, error)
- type SharedSecret
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UnmarshalPublic ¶
UnmarshalPublic restore public key from string
Types ¶
type KeyPair ¶
type KeyPair struct {
// contains filtered or unexported fields
}
KeyPair crypto key pair
func GenerateKeyCustomCurve ¶
GenerateKey generate new random key pair by custom curve
func UnmarshalCustomCurve ¶
func UnmarshalCustomCurve(curve elliptic.Curve, privateKeyStr, publicKeyStr string) (*KeyPair, error)
UnmarshalCustomCurve restore key pair from privateKey and publicKey string by custom curve
func (*KeyPair) GenerateSecret ¶
func (kp *KeyPair) GenerateSecret(anotherPublicKey ecdsa.PublicKey) (*SharedSecret, error)
GenerateSecret generate shared secret
func (*KeyPair) PrivateKey ¶
func (kp *KeyPair) PrivateKey() *ecdsa.PrivateKey
PrivateKey return private key from key pair
func (*KeyPair) Sign ¶
Sign sign random generated hash by private key, returns signed hash, raw hash
func (*KeyPair) SignCustomCache ¶
Sign sign hash by private key, returns signed hash
type SharedSecret ¶
type SharedSecret struct { // contains filtered or unexported fields }
SharedSecret shared by ECDH secret
func NewSharedSecret ¶
func NewSharedSecret(secret string) (*SharedSecret, error)
NewSharedSecret create new SharedSecret by raw secret
Click to show internal directories.
Click to hide internal directories.