keymgt

package
v0.0.0-...-7d2715d Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertBase64StrToBytes

func ConvertBase64StrToBytes(key string) ([]byte, error)

ConvertBase64StrToBytes decodes a base64 encoded string and converts to bytes.

func ConvertPrivateKeyToInterface

func ConvertPrivateKeyToInterface(privateKey *rsa.PrivateKey) interface{}

ConvertPrivateKeyToInterface creates an interface abstraction for an RSA private key.

func ConvertPublicKeyToInterface

func ConvertPublicKeyToInterface(publicKey *rsa.PublicKey) interface{}

ConvertPublicKeyToInterface creates an interface abstraction for an RSA public key.

func ConvertToBase64Str

func ConvertToBase64Str(key []byte) string

ConvertToBase64Str converts bytes to a base64 encoded string.

func CreateRSAKeys

func CreateRSAKeys(keySize int) (*rsa.PrivateKey, *rsa.PublicKey, error)

CreateRSAKeys creates a private/public RSA key pair.

func CreateRandomKeyBytes

func CreateRandomKeyBytes(keySize int) ([]byte, error)

CreateRandomKeyBytes creates a random slice of bytes with support for 16, 24 and 32 byte lengths.

func LoadPrivateKeyFromPemData

func LoadPrivateKeyFromPemData(reader io.Reader) (*rsa.PrivateKey, error)

LoadPrivateKeyFromPemData extracts the pem encoded private key and converts it to a private key structure.

func LoadPublicKeyFromPemData

func LoadPublicKeyFromPemData(reader io.Reader) *rsa.PublicKey

LoadPublicKeyFromPemData extracts the pem encoded public key and converts it to a public key structure.

func PemEncodeKeyToOutput

func PemEncodeKeyToOutput(key interface{}, out io.Writer) string

PemEncodeKeyToOutput creates a pem encoding for the provided key and writes the encoded block to the provided io.Writer.

A PEM type convention name is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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