Documentation ¶
Index ¶
- Constants
- func AESDecrypt(key, msg []byte) []byte
- func AESEncrypt(key, msg []byte) []byte
- func Argon2iDeriveKey(p, s []byte) []byte
- func Argon2idDeriveKey(p, s []byte) []byte
- func AsymmetricDecrypt(chipertext []byte, sk *rsa.PrivateKey) []byte
- func AsymmetricEncrypt(plaintext []byte, pk *rsa.PublicKey) []byte
- func AsymmetricOpen(chipertext []byte, sk *rsa.PrivateKey, pk *rsa.PublicKey) []byte
- func AsymmetricSeal(plaintext []byte, pk *rsa.PublicKey, sk *rsa.PrivateKey) []byte
- func AsymmetricSign(message []byte, sk *rsa.PrivateKey) []byte
- func AsymmetricSignWithHash(message []byte, sk *rsa.PrivateKey) ([]byte, []byte)
- func AsymmetricVerify(message []byte, pk *rsa.PublicKey, signature []byte) bool
- func AsymmetricVerifyWithHash(message []byte, pk *rsa.PublicKey, signature, hash []byte) bool
- func Decrypt(chiper string, key, msg []byte) []byte
- func DeriveKey(derivetype, passphrase, salt string) []byte
- func Encrypt(chiper string, key, msg []byte) []byte
- func KeyDerive(passphrase string) []byte
- func Nonce(size int) []byte
- func Open(chipertext, secret string) (plaintext string)
- func PKBDF2DeriveKey(p, s []byte) []byte
- func PWCheck(pw, pwc, salt string) bool
- func PWHash(pass, salt string) string
- func RSADencrypt(key *rsa.PrivateKey, msg []byte) []byte
- func RSAEncrypt(key *rsa.PublicKey, msg []byte) []byte
- func RSAGenKeyPair(keySize int) (*rsa.PrivateKey, *rsa.PublicKey)
- func RSAReadEncryptedPrivateKey(fn, p string) *rsa.PrivateKey
- func RSAReadKeyPair(filebasename string, passphrase string) (sk *rsa.PrivateKey, pk *rsa.PublicKey)
- func RSAReadPrivateKey(fn string) *rsa.PrivateKey
- func RSAReadPublicKey(fn string) *rsa.PublicKey
- func RSARenGenPubKey(filebasename string, passphrase string)
- func RSASign(key *rsa.PrivateKey, msg []byte) (msgHashSum, sig []byte)
- func RSAVerify(key *rsa.PublicKey, msgHashSum, sig []byte) bool
- func RSAWriteEncryptedPricvateKey(fn string, p string, v interface{}) error
- func RSAWriteKey(fn string, v interface{}) error
- func RSAWriteKeyPair(filebasename string, priv *rsa.PrivateKey, pub *rsa.PublicKey, ...)
- func RandomString(size int) string
- func Salt(size int) string
- func Seal(plaintext, secret string) (chipertext string)
- func SymmetricOpen(chipertext, key []byte) []byte
- func SymmetricSeal(plaintext, key []byte) []byte
- func XCPDecrypt(key, msg []byte) []byte
- func XCPEncrypt(key, msg []byte) []byte
- type RSAEncryptedPrivateKey
Constants ¶
View Source
const ( // Chiper Type to use: aesgcm, xchaha20poly1305 //CHIPERTYPE = "aesgcm" CHIPERTYPE = "xchacha20poly1305" // Key Derivation: simple, pbkdf2, argon2 KDFTYPE = "pkbdf2" )
View Source
const (
// SHA256
AsymmetricHashSumSize = 32
)
Variables ¶
This section is empty.
Functions ¶
func AESDecrypt ¶
func AESEncrypt ¶
func AsymmetricDecrypt ¶
func AsymmetricDecrypt(chipertext []byte, sk *rsa.PrivateKey) []byte
func AsymmetricEncrypt ¶
Anonymous Public-Key Encryption
func AsymmetricOpen ¶
Currently not implemented
func AsymmetricSeal ¶
Currently not implemented
func AsymmetricSign ¶
func AsymmetricSign(message []byte, sk *rsa.PrivateKey) []byte
AsymmetricSign return a byte stream with hashsum and signature concat
func AsymmetricSignWithHash ¶
func AsymmetricSignWithHash(message []byte, sk *rsa.PrivateKey) ([]byte, []byte)
func AsymmetricVerify ¶
func RSADencrypt ¶
func RSADencrypt(key *rsa.PrivateKey, msg []byte) []byte
func RSAGenKeyPair ¶
func RSAGenKeyPair(keySize int) (*rsa.PrivateKey, *rsa.PublicKey)
func RSAReadEncryptedPrivateKey ¶
func RSAReadEncryptedPrivateKey(fn, p string) *rsa.PrivateKey
func RSAReadKeyPair ¶
func RSAReadPrivateKey ¶
func RSAReadPrivateKey(fn string) *rsa.PrivateKey
func RSAReadPublicKey ¶
func RSARenGenPubKey ¶
#ISSUE if you your privkey is encrypted and you regen pub key with option uncrypted this leads to an empty pubkey Won't fix cause no data loose and you can simply regen pub key anyway.
func RSASign ¶
func RSASign(key *rsa.PrivateKey, msg []byte) (msgHashSum, sig []byte)
### RSA Sign and Verify
func RSAWriteKey ¶
func RSAWriteKeyPair ¶
func RandomString ¶
func SymmetricOpen ¶
func SymmetricSeal ¶
Use AEAD Terminology Seal == Encrypte and Open == Decrypt
func XCPDecrypt ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.