Documentation ¶
Overview ¶
cipher package is a helper package for encrypting and decrypting messages
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePrivateKey ¶
func GeneratePrivateKey(size int) *rsa.PrivateKey
GeneratePrivateKey will create a private key with the size given size must be greater than 64 or else it will default to 64.
Careful with the size, if its too large it won't encrypt the message or take forever
Types ¶
type Crypt ¶
type Crypt interface { // EncryptMessage attempts to encode the message into an array of bytes. // and error will be returned if failed to encode the message. EncryptMessage(message []byte) ([]byte, error) // DecryptMessage attempts to decode the message into a string. // and error will be returned if failed to decode the message. DecryptMessage(cipher []byte) ([]byte, error) }
Crypt represents the ability to encrypt and decrypt messages
type Interface ¶
I the Interface for cipher to encrypt decrypt and verify the message
func NewCrypter ¶
func NewCrypter(hash crypto.Hash, key *rsa.PrivateKey) Interface
type Verify ¶
type Verify interface { // Sign attempts to sign the message into an array of bytes // and an error will be returned if a failure is encountered while signing the message. Sign(message []byte) ([]byte, error) // VerifyMessage will return true if the message was successfully verified VerifyMessage(message []byte, signature []byte) bool }
Verify is used to sign and verify the signature of a message
Click to show internal directories.
Click to hide internal directories.