key

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package key provides RSA Key API management for crypto/x509/rsa.

This package makes easy to generate Keys and load RSA from files to be used by GoLang applications.

Generating RSA Keys, the files will be saved in the $CAPATH by default. For $CAPATH, please check out the GoCA documentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertPrivateKeyFromDerToPem

func ConvertPrivateKeyFromDerToPem(privateKey *rsa.PrivateKey) (privateKeyPem []byte, err error)

ConvertPrivateKeyFromDerToPem permit to convert private key from DER format to PEM format

func ConvertPublicKeyFromDerToPem

func ConvertPublicKeyFromDerToPem(publicKey *rsa.PublicKey) (publicKeyPem []byte, err error)

ConvertPrivateKeyFromDerToPem permit to convert public key from DER format to PEM format

func ConvertRsaPrivateKeyFromDerToPem added in v1.0.4

func ConvertRsaPrivateKeyFromDerToPem(privateKey *rsa.PrivateKey) (rsaPrivateKeyPem []byte, err error)

ConvertRsaPrivateKeyFromDerToPem permit to convert private key from DER format to PEM format

func LoadPrivateKeyFromPem

func LoadPrivateKeyFromPem(keyPem []byte) (*rsa.PrivateKey, error)

LoadPrivateKey loads a RSA Private Key from a pem contend.

func LoadPublicKeyFromPem

func LoadPublicKeyFromPem(keyPem []byte) (*rsa.PublicKey, error)

LoadPublicKey loads a RSA Public Key from a pem contend.

Types

type KeysData

type KeysData struct {
	Key       *rsa.PrivateKey
	PublicKey *rsa.PublicKey
}

KeysData represents the RSA keys with Private Key (Key) and Public Key (Public Key).

func CreateKeys

func CreateKeys(CACommonName, commonName string, bitSize int) (KeysData, error)

CreateKeys creates RSA private and public keyData that contains Key and PublicKey.

Jump to

Keyboard shortcuts

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