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 BasicHashLoader ¶ added in v0.3.0
type BasicHashLoader struct {
HashName string
}
type Decrypt ¶ added in v0.3.0
type Decrypt interface { // 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) }
Decrypt represents the ability to decrypt messages
type Enrypt ¶ added in v0.3.0
type Enrypt 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) }
Enrypt represents the ability to encrypt messages
type FileLoader ¶ added in v0.3.0
type FileLoader struct {
Path string
}
func (*FileLoader) GetBytes ¶ added in v0.3.0
func (f *FileLoader) GetBytes() ([]byte, error)
type HashLoader ¶ added in v0.3.0
type LoadConfig ¶ added in v0.3.0
type LoadConfig struct { Hash HashLoader Key KeyLoader }
type LocalCerts ¶ added in v0.3.0
type PrivateKeyCipher ¶ added in v0.3.0
PrivateKeyCipher handles functionality provided with a privateKey
func LoadPrivate ¶ added in v0.3.0
func LoadPrivate(v *viper.Viper) (PrivateKeyCipher, error)
func LoadPrivateKey ¶ added in v0.3.0
func LoadPrivateKey(config LoadConfig) (PrivateKeyCipher, error)
func NewPrivateCrypter ¶ added in v0.3.0
func NewPrivateCrypter(hash crypto.Hash, key *rsa.PrivateKey) PrivateKeyCipher
type PublicKeyCipher ¶ added in v0.3.0
PrivateKeyCipher handles functionality provided with a publicKey
func LoadPublic ¶ added in v0.3.0
func LoadPublic(v *viper.Viper) (PublicKeyCipher, error)
func LoadPublicKey ¶ added in v0.3.0
func LoadPublicKey(config LoadConfig) (PublicKeyCipher, error)
func NewPublicCrypter ¶ added in v0.3.0
func NewPublicCrypter(hash crypto.Hash, key *rsa.PublicKey) PublicKeyCipher
Click to show internal directories.
Click to hide internal directories.