Versions in this module Expand all Collapse all v0 v0.1.1 Feb 19, 2021 v0.1.1-3 Feb 19, 2021 v0.1.1-2 Feb 19, 2021 v0.1.1-1 Feb 19, 2021 v0.1.0 Jan 11, 2021 v0.0.2 Jan 11, 2021 v0.0.1 Jan 9, 2021 v0.0.0 Apr 25, 2021 Changes in this version + var KeyTypes = []KeyType + func CatalogDecrypt(key, data []byte, catalog interface{}) error + func CatalogEncrypt(catalog interface{}) ([]byte, []byte, error) + func CreateCatalogKey() ([]byte, error) + func Decrypt(key PrivKey, settings *EncryptionSettings, ciphertext []byte) ([]byte, error) + func DualKeyGetSecret(priv PrivKey, txID TransactionID) ([]byte, bool, error) + func EdPrivToX25519(privateKey ed25519.PrivateKey) []byte + func EdPubToX25519(pk ed25519.PublicKey) []byte + func GenerateIvAndKey() ([]byte, []byte, error) + func GenerateKeyPair(kt KeyType) (*PrivKey, *PubKey, error) + func GetAesDecryptorReader(iv []byte, key []byte, r io.Reader) (io.Reader, error) + func GetAesEncryptorReader(iv []byte, key []byte, r io.Reader) (io.Reader, error) + func GetMnemonic(kp *KeyPair) string + func JSONDecrypt(key []byte, ciphertext []byte, v interface{}) error + func JSONEncrypt(key []byte, data interface{}) ([]byte, error) + func KeyExchange(privK PrivKey, pubK PubKey) ([]byte, error) + func MessageDecrypt(key []byte, message []byte) ([]byte, error) + func MessageEncrypt(key []byte, plaintext []byte) ([]byte, error) + func MnemonicToRandomSeed(mnemonic string) ([]byte, error) + func RandomSeedToMnemonic(seed []byte) (string, error) + func Sign(key PrivKey, message []byte) ([]byte, error) + func Verify(key PubKey, message []byte, sig []byte) (bool, error) + type CryptoType string + const EcdsaAES + const Ed25519AES + const RsaOAEP + const Rsav15 + type EncryptionSettings struct + TransactionID string + Type CryptoType + func Encrypt(pubKey PubKey, msg []byte) ([]byte, *EncryptionSettings, error) + type KeyEcdsa struct + Curve elliptic.Curve + func (k *KeyEcdsa) CanDualKeyExchange() bool + func (k *KeyEcdsa) CanEncrypt() bool + func (k *KeyEcdsa) CanKeyExchange() bool + func (k *KeyEcdsa) Decrypt(key PrivKey, settings *EncryptionSettings, cipherText []byte) ([]byte, error) + func (k *KeyEcdsa) DualKeyExchange(pub PubKey) ([]byte, *TransactionID, error) + func (k *KeyEcdsa) Encrypt(key PubKey, msg []byte) ([]byte, *EncryptionSettings, error) + func (k *KeyEcdsa) GenerateKeyPair(r io.Reader) (*PrivKey, *PubKey, error) + func (k *KeyEcdsa) JWTHasValidSignMethod(token *jwt.Token) bool + func (k *KeyEcdsa) JWTSignMethod() jwt.SigningMethod + func (k *KeyEcdsa) KeyExchange(privK PrivKey, pubK PubKey) ([]byte, error) + func (k *KeyEcdsa) ParsePrivateKeyData(buf []byte) (interface{}, error) + func (k *KeyEcdsa) ParsePrivateKeyInterface(key interface{}) ([]byte, error) + func (k *KeyEcdsa) ParsePublicKeyData(buf []byte) (interface{}, error) + func (k *KeyEcdsa) ParsePublicKeyInterface(key interface{}) ([]byte, error) + func (k *KeyEcdsa) Sign(_ io.Reader, key PrivKey, message []byte) ([]byte, error) + func (k *KeyEcdsa) String() string + func (k *KeyEcdsa) Verify(key PubKey, message []byte, sig []byte) (bool, error) + type KeyEd25519 struct + func (k *KeyEd25519) CanDualKeyExchange() bool + func (k *KeyEd25519) CanEncrypt() bool + func (k *KeyEd25519) CanKeyExchange() bool + func (k *KeyEd25519) Decrypt(key PrivKey, settings *EncryptionSettings, cipherText []byte) ([]byte, error) + func (k *KeyEd25519) DualKeyExchange(pub PubKey) ([]byte, *TransactionID, error) + func (k *KeyEd25519) Encrypt(key PubKey, msg []byte) ([]byte, *EncryptionSettings, error) + func (k *KeyEd25519) GenerateKeyPair(r io.Reader) (*PrivKey, *PubKey, error) + func (k *KeyEd25519) JWTHasValidSignMethod(token *jwt.Token) bool + func (k *KeyEd25519) JWTSignMethod() jwt.SigningMethod + func (k *KeyEd25519) KeyExchange(privK PrivKey, pubK PubKey) ([]byte, error) + func (k *KeyEd25519) ParsePrivateKeyData(buf []byte) (interface{}, error) + func (k *KeyEd25519) ParsePrivateKeyInterface(key interface{}) ([]byte, error) + func (k *KeyEd25519) ParsePublicKeyData(buf []byte) (interface{}, error) + func (k *KeyEd25519) ParsePublicKeyInterface(key interface{}) ([]byte, error) + func (k *KeyEd25519) Sign(reader io.Reader, key PrivKey, message []byte) ([]byte, error) + func (k *KeyEd25519) String() string + func (k *KeyEd25519) Verify(key PubKey, message []byte, sig []byte) (bool, error) + type KeyPair struct + FingerPrint string + Generator string + PrivKey PrivKey + PubKey PubKey + func CreateKeypair(kt KeyType, seed []byte) (*KeyPair, error) + func GenerateKeypairFromMnemonic(mnemonic string) (*KeyPair, error) + func GenerateKeypairWithRandomSeed(kt KeyType) (*KeyPair, error) + type KeyRsa struct + BitSize int + Type string + func (k *KeyRsa) CanDualKeyExchange() bool + func (k *KeyRsa) CanEncrypt() bool + func (k *KeyRsa) CanKeyExchange() bool + func (k *KeyRsa) Decrypt(key PrivKey, settings *EncryptionSettings, ciphertext []byte) ([]byte, error) + func (k *KeyRsa) DualKeyExchange(_ PubKey) ([]byte, *TransactionID, error) + func (k *KeyRsa) Encrypt(pubKey PubKey, msg []byte) ([]byte, *EncryptionSettings, error) + func (k *KeyRsa) GenerateKeyPair(r io.Reader) (*PrivKey, *PubKey, error) + func (k *KeyRsa) JWTHasValidSignMethod(token *jwt.Token) bool + func (k *KeyRsa) JWTSignMethod() jwt.SigningMethod + func (k *KeyRsa) KeyExchange(_ PrivKey, _ PubKey) ([]byte, error) + func (k *KeyRsa) ParsePrivateKeyData(buf []byte) (interface{}, error) + func (k *KeyRsa) ParsePrivateKeyInterface(key interface{}) ([]byte, error) + func (k *KeyRsa) ParsePublicKeyData(buf []byte) (interface{}, error) + func (k *KeyRsa) ParsePublicKeyInterface(key interface{}) ([]byte, error) + func (k *KeyRsa) Sign(_ io.Reader, key PrivKey, message []byte) ([]byte, error) + func (k *KeyRsa) String() string + func (k *KeyRsa) Verify(key PubKey, message []byte, sig []byte) (bool, error) + type KeyType interface + CanDualKeyExchange func() bool + CanEncrypt func() bool + CanKeyExchange func() bool + Decrypt func(PrivKey, *EncryptionSettings, []byte) ([]byte, error) + DualKeyExchange func(_ PubKey) ([]byte, *TransactionID, error) + Encrypt func(PubKey, []byte) ([]byte, *EncryptionSettings, error) + GenerateKeyPair func(io.Reader) (*PrivKey, *PubKey, error) + JWTHasValidSignMethod func(*jwt.Token) bool + JWTSignMethod func() jwt.SigningMethod + KeyExchange func(privK PrivKey, pubK PubKey) ([]byte, error) + ParsePrivateKeyData func([]byte) (interface{}, error) + ParsePrivateKeyInterface func(interface{}) ([]byte, error) + ParsePublicKeyData func([]byte) (interface{}, error) + ParsePublicKeyInterface func(interface{}) ([]byte, error) + Sign func(io.Reader, PrivKey, []byte) ([]byte, error) + String func() string + Verify func(PubKey, []byte, []byte) (bool, error) + func FindKeyType(typ string) (KeyType, error) + func NewEcdsaKey(curve elliptic.Curve) KeyType + func NewEd25519Key() KeyType + func NewRsaKey(bits int) KeyType + type PrivKey struct + B []byte + K interface{} + S string + Type KeyType + func PrivateKeyFromInterface(kt KeyType, key interface{}) (*PrivKey, error) + func PrivateKeyFromString(data string) (*PrivKey, error) + func (pk *PrivKey) MarshalJSON() ([]byte, error) + func (pk *PrivKey) String() string + func (pk *PrivKey) UnmarshalJSON(b []byte) error + type PubKey struct + B []byte + Description string + K interface{} + S string + Type KeyType + func PublicKeyFromInterface(kt KeyType, key interface{}) (*PubKey, error) + func PublicKeyFromString(data string) (*PubKey, error) + func (pk *PubKey) Fingerprint() string + func (pk *PubKey) MarshalJSON() ([]byte, error) + func (pk *PubKey) String() string + func (pk *PubKey) UnmarshalJSON(b []byte) error + type SigningMethodEdDSA struct + func (m *SigningMethodEdDSA) Alg() string + func (m *SigningMethodEdDSA) Sign(signingString string, key interface{}) (str string, err error) + func (m *SigningMethodEdDSA) Verify(signingString string, signature string, key interface{}) error + type TransactionID struct + P []byte + R []byte + func DualKeyExchange(pub PubKey) ([]byte, *TransactionID, error) + func TxIDFromString(s string) (*TransactionID, error) + func (txID TransactionID) ToHex() string