secutil

package
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func LoadPublicKeyFromFile(pubPath string) (*rsa.PublicKey, error)

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

func PublicKeyFromBase64(key string) (*rsa.PublicKey, error)

PublicKeyFromBase64 convert a base64 string to a RSA public key.

func PublicKeyFromBytes

func PublicKeyFromBytes(publicKeyBytes []byte) (*rsa.PublicKey, error)

PublicKeyFromBytes convert a base64 bytes to a RSA public key.

func PublicKeyToBase64

func PublicKeyToBase64(publicKey *rsa.PublicKey) (string, error)

PublicKeyToBase64 convert a RSA public key to a base64 string.

func PublicKeyToBytes

func PublicKeyToBytes(publicKey *rsa.PublicKey) ([]byte, error)

PublicKeyToBytes converts a pair of RSA public key to []byte.

func RSAKeyToBytes

func RSAKeyToBytes(privateKey *rsa.PrivateKey, publicKey *rsa.PublicKey) ([]byte, []byte, error)

RSAKeyToBytes converts a pair of RSA private and public keys to []byte.

func SavePrivateKeyToFile

func SavePrivateKeyToFile(privateKeyBytes []byte, pemPath string) error

SavePrivateKeyToFile saves a RSA private key to a key file.

func SavePublicKeyToFile

func SavePublicKeyToFile(publicKeyBytes []byte, pubPath string) error

SavePublicKeyToFile saves a RSA public key to a key file.

func SaveRSAKeyToFile

func SaveRSAKeyToFile(privateKeyBytes []byte, pemPath string, publicKeyBytes []byte, pubPath string) error

SaveRSAKeyToFile saves a pair of RSA private and public keys to each key file.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL