Documentation ¶
Index ¶
- func DecodeMessage(key, ciphertext []byte, prv *rsa.PrivateKey) ([]byte, error)
- func DecodeMessagePEM(w io.Writer, cipherpems []byte, prv *rsa.PrivateKey) error
- func DecodePEMType(pemContents []byte, blockType string) ([]byte, error)
- func DecodePrivateKeyPEM(pemContents []byte) (*rsa.PrivateKey, error)
- func DecodePublicKeyPEM(pemContents []byte) (*rsa.PublicKey, error)
- func Decrypt(ciphertext []byte, key *[32]byte) (plaintext []byte, err error)
- func EncodeMessage(plaintext []byte, pub *rsa.PublicKey) (otp *[32]byte, key, ciphertext []byte, err error)
- func EncodeMessagePEM(w io.Writer, plaintext []byte, pub *rsa.PublicKey) error
- func EncodePrivateKeyPEM(w io.Writer, key *rsa.PrivateKey) error
- func EncodePublicKeyPEM(w io.Writer, key *rsa.PublicKey) error
- func Encrypt(plaintext []byte, key *[32]byte) (ciphertext []byte, err error)
- func NewEncryptionKey() *[32]byte
- func NewRSAPrivateKey(bitSize int) *rsa.PrivateKey
- func ReadPrivateKeyPEM(fileName string) (*rsa.PrivateKey, error)
- func ReadPublicKeyPEM(fileName string) (*rsa.PublicKey, error)
- func SavePrivateKeyPEM(fileName string, key *rsa.PrivateKey) error
- func SavePublicKeyPEM(fileName string, key *rsa.PublicKey) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeMessage ¶
func DecodeMessage(key, ciphertext []byte, prv *rsa.PrivateKey) ([]byte, error)
func DecodeMessagePEM ¶
func DecodePrivateKeyPEM ¶
func DecodePrivateKeyPEM(pemContents []byte) (*rsa.PrivateKey, error)
func Decrypt ¶
Decrypt decrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Expects input form nonce|ciphertext|tag where '|' indicates concatenation.
func EncodeMessage ¶
func EncodeMessagePEM ¶
func EncodePrivateKeyPEM ¶
func EncodePrivateKeyPEM(w io.Writer, key *rsa.PrivateKey) error
func Encrypt ¶
Encrypt encrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Output takes the form nonce|ciphertext|tag where '|' indicates concatenation.
func NewEncryptionKey ¶
func NewEncryptionKey() *[32]byte
NewEncryptionKey generates a random 256-bit key for Encrypt() and Decrypt(). It panics if the source of randomness fails.
func NewRSAPrivateKey ¶
func NewRSAPrivateKey(bitSize int) *rsa.PrivateKey
func ReadPrivateKeyPEM ¶
func ReadPrivateKeyPEM(fileName string) (*rsa.PrivateKey, error)
func SavePrivateKeyPEM ¶
func SavePrivateKeyPEM(fileName string, key *rsa.PrivateKey) error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.