Documentation ¶
Index ¶
- func GenerateKey(opt AlgorithmOption) (crypto.PrivateKey, error)
- func Unmarshal(data []byte) (crypto.PrivateKey, error)
- func UnmarshalPrivateKey(data []byte, opt AlgorithmOption) (crypto.PrivateKey, error)
- func UnmarshalPublicKey(data []byte, opt AlgorithmOption) (crypto.PublicKey, error)
- type AlgorithmOption
- type PrivateKey
- type PublicKey
- type Sig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKey ¶
func GenerateKey(opt AlgorithmOption) (crypto.PrivateKey, error)
GenerateKey generate a pair of key,input is algorithm type
func UnmarshalPrivateKey ¶
func UnmarshalPrivateKey(data []byte, opt AlgorithmOption) (crypto.PrivateKey, error)
func UnmarshalPublicKey ¶
func UnmarshalPublicKey(data []byte, opt AlgorithmOption) (crypto.PublicKey, error)
Types ¶
type AlgorithmOption ¶
type AlgorithmOption string
const ( // Secp256k1 secp256k1 algorithm Secp256k1 AlgorithmOption = "Secp256k1" // Secp256r1 secp256r1 algorithm Secp256r1 AlgorithmOption = "Secp256r1" )
type PrivateKey ¶
type PrivateKey struct {
K *ecdsa.PrivateKey
}
PrivateKey ECDSA private key. never new(PrivateKey), use NewPrivateKey()
func (*PrivateKey) Bytes ¶
func (priv *PrivateKey) Bytes() ([]byte, error)
Bytes returns a serialized, storable representation of this key
func (*PrivateKey) PublicKey ¶
func (priv *PrivateKey) PublicKey() crypto.PublicKey
Click to show internal directories.
Click to hide internal directories.