Documentation ¶
Index ¶
Constants ¶
View Source
const ( // KeyType_PubRSA public key of rsa KeyType_PubRSA = "RsaPublicKey" // KeyType_PriRSA private key of rsa KeyType_PriRSA = "RsaPrivateKey" // KeyType_PubED25119 public key of ed25519 KeyType_PubED25119 = "EdDsaPublicKey" // KeyType_PriED25119 private key of ed25519 KeyType_PriED25119 = "EdDsaPrivateKey" )
View Source
const ( // Usage_EncDec used for encrypt and decrypt Usage_EncDec = "EncryptDecrypt" // Usage_SignVerify used for signature and verify Usage_SignVerify = "SignVerify" // Usage_Other used for all other unused crypto option Usage_Other = "Other" )
View Source
const ( // PublicKeySize is the size, in bytes, of public keys as used in this package. PublicKeySize = 32 // PrivateKeySize is the size, in bytes, of private keys as used in this package. PrivateKeySize = 64 // SignatureSize is the size, in bytes, of signatures generated and verified by this package. SignatureSize = 64 )
Variables ¶
This section is empty.
Functions ¶
func Keypair ¶
func Keypair() (pub *PublicKey, pri *PrivateKey, err error)
KeyPair generate keypair of ed25519
Types ¶
type PrivateKey ¶
type PrivateKey struct { Usage string `json:"usage"` KeyType string `json:"key_type"` PrivateKeyData []byte `json:"private_key_data"` }
PrivateKey store private key and its information
func (*PrivateKey) GetRawData ¶
func (privateKey *PrivateKey) GetRawData() []byte
GetRawData return the key
func (*PrivateKey) GetType ¶
func (privateKey *PrivateKey) GetType() string
GetType return type of the key
func (*PrivateKey) GetUsage ¶
func (privateKey *PrivateKey) GetUsage() string
GetUsage return usage of the key
type PublicKey ¶
type PublicKey struct { Usage string `json:"usage"` KeyType string `json:"key_type"` PublicKeyData []byte `json:"public_key_data"` }
PublicKey store public key and its information
func (*PublicKey) GetRawData ¶
GetRawData return the key
Click to show internal directories.
Click to hide internal directories.