Documentation ¶
Index ¶
- Variables
- func GenerateRSAKey() (*rsa.PrivateKey, *rsa.PublicKey, error)
- func LoadPrivateKeyFromFile(pemPath string) (*rsa.PrivateKey, error)
- func LoadPublicKeyFromFile(pubPath string) (*rsa.PublicKey, error)
- func PrivateKeyFromBytes(privateKeyBytes []byte) (*rsa.PrivateKey, error)
- func PrivateKeyToBytes(privateKey *rsa.PrivateKey) ([]byte, error)
- func PublicKeyFromBase64(key string) (*rsa.PublicKey, error)
- func PublicKeyFromBytes(publicKeyBytes []byte) (*rsa.PublicKey, error)
- func PublicKeyToBase64(publicKey *rsa.PublicKey) (string, error)
- func PublicKeyToBytes(publicKey *rsa.PublicKey) ([]byte, error)
- func RSAKeyToBytes(privateKey *rsa.PrivateKey, publicKey *rsa.PublicKey) ([]byte, []byte, error)
- func SavePrivateKeyToFile(privateKeyBytes []byte, pemPath string) error
- func SavePublicKeyToFile(publicKeyBytes []byte, pubPath string) error
- func SaveRSAKeyToFile(privateKeyBytes []byte, pemPath string, publicKeyBytes []byte, pubPath string) error
Constants ¶
This section is empty.
Variables ¶
var CBLogger *logrus.Logger
CBLogger represents a logger to show execution processes according to the logging level.
Functions ¶
func GenerateRSAKey ¶
func GenerateRSAKey() (*rsa.PrivateKey, *rsa.PublicKey, error)
GenerateRSAKey generates a pair of RSA private and public keys.
func LoadPrivateKeyFromFile ¶
func LoadPrivateKeyFromFile(pemPath string) (*rsa.PrivateKey, error)
LoadPrivateKeyFromFile loads a RSA private key from a key file.
func LoadPublicKeyFromFile ¶
LoadPublicKeyFromFile loads a RSA public key from a key file.
func PrivateKeyFromBytes ¶
func PrivateKeyFromBytes(privateKeyBytes []byte) (*rsa.PrivateKey, error)
PrivateKeyFromBytes convert a base64 bytes to a RSA private key.
func PrivateKeyToBytes ¶
func PrivateKeyToBytes(privateKey *rsa.PrivateKey) ([]byte, error)
PrivateKeyToBytes converts a pair of RSA private key to []byte.
func PublicKeyFromBase64 ¶
PublicKeyFromBase64 convert a base64 string to a RSA public key.
func PublicKeyFromBytes ¶
PublicKeyFromBytes convert a base64 bytes to a RSA public key.
func PublicKeyToBase64 ¶
PublicKeyToBase64 convert a RSA public key to a base64 string.
func PublicKeyToBytes ¶
PublicKeyToBytes converts a pair of RSA public key to []byte.
func RSAKeyToBytes ¶
RSAKeyToBytes converts a pair of RSA private and public keys to []byte.
func SavePrivateKeyToFile ¶
SavePrivateKeyToFile saves a RSA private key to a key file.
func SavePublicKeyToFile ¶
SavePublicKeyToFile saves a RSA public key to a key file.
Types ¶
This section is empty.