secrets

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEncryptionBits = 2048
)

Variables

This section is empty.

Functions

func BytesToPrivateKey

func BytesToPrivateKey(privateKey []byte) (*rsa.PrivateKey, error)

func BytesToPublicKey

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

func PrivateKeyToBytes

func PrivateKeyToBytes(priv *rsa.PrivateKey) []byte

func PublicKeyToBytes

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

Types

type RSA

type RSA struct {
	Bits int
}

func NewRSAHandler

func NewRSAHandler(bits int) *RSA

func (*RSA) DecryptWithPrivateKey

func (r *RSA) DecryptWithPrivateKey(msg []byte, key []byte) ([]byte, error)

func (*RSA) EncryptWithPublicKey

func (r *RSA) EncryptWithPublicKey(msg []byte, key []byte) ([]byte, error)

func (*RSA) GenerateKeyPair

func (r *RSA) GenerateKeyPair() ([]byte, []byte, error)

Jump to

Keyboard shortcuts

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