Documentation ¶
Index ¶
- Constants
- Variables
- func AedCipherSizes(byte AedCipherByte) (key, iv, block int)
- func ConstantTimeByteEq(a, b []byte) bool
- func DeriveSaltSize(byte DeriveByte) int
- func HashCrypto(byte HashByte) crypto.Hash
- func HashSize(byte HashByte) int
- func MacSize(byte MacByte) int
- func SecureRand(buff []byte) error
- func SecureRandSize(size int) ([]byte, error)
- type AedCipherByte
- type AesAedCipher
- type Derive
- type DeriveByte
- type DeriveFN
- type Hash
- type HashByte
- type IAedCipher
- type IDerive
- type IHash
- type IMac
- type IPubCipher
- type Mac
- type MacByte
- type MacNewFN
- type PubCipherByte
- type RsaCipher
- func (r *RsaCipher) Decrypt(priv []byte, data []byte) ([]byte, error)
- func (r *RsaCipher) Encrypt(pub []byte, data []byte) ([]byte, error)
- func (r *RsaCipher) GeneratePair() (priv, pub []byte, err error)
- func (r *RsaCipher) Sign(priv []byte, data []byte) ([]byte, error)
- func (r *RsaCipher) Verify(pub []byte, data []byte, sig []byte) error
Constants ¶
View Source
const ( AedCipherUnknown = AedCipherByte(iota) AES256GCM )
View Source
const ( DeriveUnknown = DeriveByte(iota) Pbkdf2Sha256 )
View Source
const ( HashUnknown = HashByte(iota) SHA256 SHA512 )
View Source
const ( MacUnknown = MacByte(iota) HmacSha256 )
View Source
const ( PubCipherUnknown = PubCipherByte(iota) Rsa4096Sha256 Rsa2048Sha256 Rsa1024Sha256 )
Variables ¶
View Source
var ( ErrBrokenSize = errors.New("ERR_BROKEN_SIZE") ErrBrokenSignature = errors.New("ERR_BROKEN_SIGNATURE") )
Functions ¶
func AedCipherSizes ¶
func AedCipherSizes(byte AedCipherByte) (key, iv, block int)
func ConstantTimeByteEq ¶
func DeriveSaltSize ¶
func DeriveSaltSize(byte DeriveByte) int
func HashCrypto ¶
func SecureRand ¶
func SecureRandSize ¶
Types ¶
type AedCipherByte ¶
type AedCipherByte byte
type AesAedCipher ¶
type AesAedCipher struct {
// contains filtered or unexported fields
}
func (*AesAedCipher) Decrypt ¶
func (a *AesAedCipher) Decrypt(input, addon []byte) ([]byte, error)
Decrypt decrypts & verifies of data
func (*AesAedCipher) Encrypt ¶
func (a *AesAedCipher) Encrypt(input, addon []byte) []byte
Encrypt encrypts and signs data
func (*AesAedCipher) Init ¶
func (a *AesAedCipher) Init(key, iv []byte) (IAedCipher, error)
type DeriveByte ¶
type DeriveByte byte
type IAedCipher ¶
type IAedCipher interface { Encrypt(plaintext, addon []byte) []byte Decrypt(ciphertext, addon []byte) ([]byte, error) Init(key, iv []byte) (IAedCipher, error) }
IAedCipher interface for block cypher with authentication algorithms
func NewAedCipher ¶
func NewAedCipher(byte AedCipherByte) IAedCipher
func NewAesAedCipher ¶
func NewAesAedCipher(keySize, ivSize int) IAedCipher
type IDerive ¶
IDerive interface for key derivation functions
func NewDerive ¶
func NewDerive(byte DeriveByte) IDerive
type IMac ¶
type IMac interface { Init(key []byte) IMac Write(data []byte) (int, error) Sum() []byte HashSum(input []byte) []byte Reset() }
IMac interface for Message Authentication Code
type IPubCipher ¶
type IPubCipher interface { GeneratePair() (priv []byte, pub []byte, err error) Encrypt(pub []byte, data []byte) ([]byte, error) Decrypt(priv []byte, data []byte) ([]byte, error) Sign(priv []byte, data []byte) ([]byte, error) Verify(pub []byte, data []byte, sig []byte) error }
func NewPubCipher ¶
func NewPubCipher(byte PubCipherByte) IPubCipher
type PubCipherByte ¶
type PubCipherByte byte
type RsaCipher ¶
type RsaCipher struct {
// contains filtered or unexported fields
}
func (*RsaCipher) GeneratePair ¶
Click to show internal directories.
Click to hide internal directories.