Documentation ¶
Index ¶
- Variables
- func NopWriteCloser(w io.Writer) io.WriteCloser
- type Crypto
- func (c *Crypto) Decrypt(data []byte, key PrivateKey) ([]byte, error)
- func (c *Crypto) DecryptAndVerify(data []byte, decryptionKey PrivateKey, verifierKeys ...PublicKey) (_ []byte, err error)
- func (c *Crypto) DecryptStream(in io.Reader, out io.Writer, key PrivateKey) (err error)
- func (c *Crypto) DecryptThenVerify(data []byte, decryptionKey PrivateKey, verifierKeys ...PublicKey) (_ []byte, err error)
- func (c *Crypto) DecryptThenVerifyStream(in io.Reader, out io.Writer, decryptionKey PrivateKey, ...) error
- func (c *Crypto) Encrypt(data []byte, recipients ...PublicKey) ([]byte, error)
- func (c *Crypto) EncryptStream(in io.Reader, out io.Writer, recipients ...PublicKey) (err error)
- func (c *Crypto) EncryptStreamWithPadding(in io.Reader, out io.Writer, padding bool, recipients ...PublicKey) (err error)
- func (c *Crypto) EncryptWithPadding(data []byte, padding bool, recipients ...PublicKey) ([]byte, error)
- func (c *Crypto) ExportPrivateKey(key PrivateKey) ([]byte, error)
- func (c *Crypto) ExportPublicKey(key PublicKey) ([]byte, error)
- func (c *Crypto) GenerateKeypair() (PrivateKey, error)
- func (c *Crypto) GenerateKeypairForType(t KeyType) (PrivateKey, error)
- func (c *Crypto) GenerateKeypairForTypeWithCustomRng(rnd foundation.Random, t KeyType) (PrivateKey, error)
- func (c *Crypto) GenerateKeypairFromKeyMaterial(keyMaterial []byte) (PrivateKey, error)
- func (c *Crypto) GenerateKeypairFromKeyMaterialForType(t KeyType, keyMaterial []byte) (PrivateKey, error)
- func (c *Crypto) Hash(data []byte, t HashType) ([]byte, error)
- func (c *Crypto) ImportPrivateKey(data []byte) (PrivateKey, error)
- func (c *Crypto) ImportPublicKey(data []byte) (PublicKey, error)
- func (c *Crypto) Random(len int) ([]byte, error)
- func (c *Crypto) Sign(data []byte, signer PrivateKey) ([]byte, error)
- func (c *Crypto) SignAndEncrypt(data []byte, signer PrivateKey, recipients ...PublicKey) (_ []byte, err error)
- func (c *Crypto) SignAndEncryptWithPadding(data []byte, signer PrivateKey, padding bool, recipients ...PublicKey) (_ []byte, err error)
- func (c *Crypto) SignStream(in io.Reader, signer PrivateKey) ([]byte, error)
- func (c *Crypto) SignThenEncrypt(data []byte, signer PrivateKey, recipients ...PublicKey) ([]byte, error)
- func (c *Crypto) SignThenEncryptStream(in io.Reader, out io.Writer, streamSize int, signer PrivateKey, ...) (err error)
- func (c *Crypto) SignThenEncryptStreamWithPadding(in io.Reader, out io.Writer, streamSize int, signer PrivateKey, padding bool, ...) (err error)
- func (c *Crypto) SignThenEncryptWithPadding(data []byte, signer PrivateKey, padding bool, recipients ...PublicKey) ([]byte, error)
- func (c *Crypto) VerifySignature(data []byte, signature []byte, key PublicKey) error
- func (c *Crypto) VerifyStream(in io.Reader, signature []byte, key PublicKey) error
- type DecryptReader
- type EncryptWriter
- type HashType
- type KeyType
- type PrivateKey
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnsupportedKeyType = errors.New("unsupported key types") ErrUnsupportedHashType = errors.New("unsupported hash types") ErrStreamSizeIncorrect = errors.New("stream size should be greater 0") ErrInvalidSeedSize = fmt.Errorf("invalid seed size (expected %d < x < %d)", foundation.KeyMaterialRngKeyMaterialLenMin, foundation.KeyMaterialRngKeyMaterialLenMax, ) ErrUnsupportedParameter = errors.New("unsupported function parameter") ErrSignVerification = errors.New("sign verification failed") ErrSignNotFound = errors.New("signature not found") )
crypto errors
Functions ¶
func NopWriteCloser ¶
func NopWriteCloser(w io.Writer) io.WriteCloser
Types ¶
type Crypto ¶
func (*Crypto) DecryptAndVerify ¶
func (*Crypto) DecryptStream ¶
func (*Crypto) DecryptThenVerify ¶
func (*Crypto) DecryptThenVerifyStream ¶
func (*Crypto) EncryptStream ¶
func (*Crypto) EncryptStreamWithPadding ¶
func (*Crypto) EncryptWithPadding ¶
func (*Crypto) ExportPrivateKey ¶
func (c *Crypto) ExportPrivateKey(key PrivateKey) ([]byte, error)
func (*Crypto) GenerateKeypair ¶
func (c *Crypto) GenerateKeypair() (PrivateKey, error)
func (*Crypto) GenerateKeypairForType ¶
func (c *Crypto) GenerateKeypairForType(t KeyType) (PrivateKey, error)
func (*Crypto) GenerateKeypairForTypeWithCustomRng ¶ added in v6.0.7
func (c *Crypto) GenerateKeypairForTypeWithCustomRng(rnd foundation.Random, t KeyType) (PrivateKey, error)
func (*Crypto) GenerateKeypairFromKeyMaterial ¶
func (c *Crypto) GenerateKeypairFromKeyMaterial(keyMaterial []byte) (PrivateKey, error)
func (*Crypto) GenerateKeypairFromKeyMaterialForType ¶
func (c *Crypto) GenerateKeypairFromKeyMaterialForType(t KeyType, keyMaterial []byte) (PrivateKey, error)
func (*Crypto) ImportPrivateKey ¶
func (c *Crypto) ImportPrivateKey(data []byte) (PrivateKey, error)
func (*Crypto) SignAndEncrypt ¶
func (*Crypto) SignAndEncryptWithPadding ¶
func (*Crypto) SignStream ¶
func (*Crypto) SignThenEncrypt ¶
func (*Crypto) SignThenEncryptStream ¶
func (*Crypto) SignThenEncryptStreamWithPadding ¶
func (*Crypto) SignThenEncryptWithPadding ¶
func (*Crypto) VerifySignature ¶
type DecryptReader ¶
type DecryptReader struct {
// contains filtered or unexported fields
}
func NewDecryptReader ¶
func NewDecryptReader(r io.Reader, cipher *foundation.RecipientCipher) *DecryptReader
type EncryptWriter ¶
type EncryptWriter struct {
// contains filtered or unexported fields
}
func NewEncryptWriter ¶
func NewEncryptWriter(w io.WriteCloser, cipher *foundation.RecipientCipher) *EncryptWriter
func (*EncryptWriter) Close ¶
func (sw *EncryptWriter) Close() error
type PrivateKey ¶
type PrivateKey interface { Identifier() []byte PublicKey() PublicKey Unwrap() foundation.PrivateKey KeyType() KeyType }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.