Documentation
¶
Index ¶
- func DecryptAes(ciphertext []byte, key []byte) ([]byte, error)
- func DecryptWithRsaPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) ([]byte, error)
- func EncryptAes(data []byte, key []byte) ([]byte, error)
- func EncryptWithRsaPublicKey(msg []byte, pub *rsa.PublicKey) ([]byte, error)
- func GenerateMd5FromStrings(strings ...string) (md5Hash string)
- func GenerateRSAKeyPair(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error)
- func GenerateRandomBytes(n int) []byte
- func RSAPublicKeyToString(pub *rsa.PublicKey) string
- func RsaPrivateKeyToString(priv *rsa.PrivateKey) string
- func StringToRsaPrivateKey(priv string) (*rsa.PrivateKey, error)
- func StringToRsaPublicKey(pub string) (*rsa.PublicKey, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptAes ¶
DecryptAes takes in a cipher text and decryptes the data. They key needs to be either 16, 24 or 32 bits.
func DecryptWithRsaPrivateKey ¶
func DecryptWithRsaPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) ([]byte, error)
Decrypts data with private RSA key
func EncryptAes ¶
EncryptAes takes in a plaintext string and a key and returns the encrypted data. They key needs to be either 16, 24 or 32 bits.
func EncryptWithRsaPublicKey ¶
Encrypts data with public RSA key
func GenerateMd5FromStrings ¶
func GenerateRSAKeyPair ¶
Generates a new RSA key pair. 2048 bits is considered the standard.
func GenerateRandomBytes ¶
Generates cryptographically secure random byte array of length n
func RSAPublicKeyToString ¶
RSA public key to base64 encoded string
func RsaPrivateKeyToString ¶
func RsaPrivateKeyToString(priv *rsa.PrivateKey) string
RSA private key to base64 encoded string
func StringToRsaPrivateKey ¶
func StringToRsaPrivateKey(priv string) (*rsa.PrivateKey, error)
Given a base64 encoded RSA private key, returns an *rsa.PrivateKey object
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.