crypto

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2016 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	RSA_BITS     = 2048 // Default number of bits in an RSA key
	RSA_BITS_MIN = 768  // Minimum number of bits in an RSA key
)

Variables

This section is empty.

Functions

func Encrypt

func Encrypt(in, privKey string) (string, error)

Encrypt encrypts a secret string.

func GeneratePrivateKey

func GeneratePrivateKey() (*rsa.PrivateKey, error)

helper function to generate an RSA Private Key.

func MarshalPrivateKey

func MarshalPrivateKey(private *rsa.PrivateKey) []byte

helper function that marshalls an RSA Private Key to a PEM encoded file.

func MarshalPublicKey

func MarshalPublicKey(public *rsa.PublicKey) []byte

helper function that marshalls an RSA Public Key to an SSH .authorized_keys format

func Rand

func Rand() string

Rand generates a 32-bit random string.

func UnmarshalPrivateKey

func UnmarshalPrivateKey(private []byte) *rsa.PrivateKey

UnmarshalPrivateKey is a helper function that unmarshals a PEM bytes to an RSA Private Key

Types

This section is empty.

Jump to

Keyboard shortcuts

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