Documentation ¶
Index ¶
- Constants
- Variables
- func DecodePrivateKey(keyBytes, password []byte) (key *ed25519PrivateKey, err error)
- func DecodePublicKey(keyBytes []byte) (*ed25519PublicKey, error)
- func EDHInit(ICa, EKa *ed25519PrivateKey, ICb, LTCb, OTCb *ed25519PublicKey) ([]byte, error)
- func EDHRespond(ICa, EKa *ed25519PublicKey, ICb, LTCb, OTCb *ed25519PrivateKey) ([]byte, error)
- func ZeroData(data []byte)
- type CMSEnvelope
- type Cipher
- type CryptoError
- type CustomParam
- type Envelope
- type KeyType
- type PFS
- type PFSSession
- type StructuralError
- type SyntaxError
- type VirgilAccessTokenSigner
- type VirgilCardCrypto
- func (c *VirgilCardCrypto) ExportPublicKey(key interface{ ... }) ([]byte, error)
- func (c *VirgilCardCrypto) GenerateSHA512(data []byte) []byte
- func (c *VirgilCardCrypto) GenerateSignature(data []byte, key interface{ ... }) ([]byte, error)
- func (c *VirgilCardCrypto) ImportPublicKey(data []byte) (interface{ ... }, error)
- func (c *VirgilCardCrypto) VerifySignature(data []byte, signature []byte, key interface{ ... }) error
- type VirgilChunkCipher
- type VirgilCrypto
- func (c *VirgilCrypto) CalculateIdentifier(data []byte) []byte
- func (c *VirgilCrypto) Decrypt(data []byte, key interface{ ... }) ([]byte, error)
- func (c *VirgilCrypto) DecryptStream(in io.Reader, out io.Writer, key interface{ ... }) error
- func (c *VirgilCrypto) DecryptThenVerify(data []byte, decryptionKey interface{ ... }, verifierKeys ...) ([]byte, error)
- func (c *VirgilCrypto) Encrypt(data []byte, recipients ...) ([]byte, error)
- func (c *VirgilCrypto) EncryptStream(in io.Reader, out io.Writer, recipients ...) error
- func (c *VirgilCrypto) ExportPrivateKey(key interface{ ... }, password string) ([]byte, error)
- func (c *VirgilCrypto) ExportPublicKey(key interface{ ... }) ([]byte, error)
- func (c *VirgilCrypto) ExtractPublicKey(key interface{ ... }) (interface{ ... }, error)
- func (c *VirgilCrypto) GenerateKeypair() (*ed25519Keypair, error)
- func (c *VirgilCrypto) ImportPrivateKey(data []byte, password string) (interface{ ... }, error)
- func (c *VirgilCrypto) ImportPublicKey(data []byte) (interface{ ... }, error)
- func (c *VirgilCrypto) ReceivePFCSession(ICa, EKa *ed25519PublicKey, ICb, LTCb, OTCb *ed25519PrivateKey, ...) (sess *PFSSession, err error)
- func (c *VirgilCrypto) SetKeyType(keyType KeyType) error
- func (c *VirgilCrypto) Sign(data []byte, key interface{ ... }) ([]byte, error)
- func (c *VirgilCrypto) SignStream(in io.Reader, key interface{ ... }) ([]byte, error)
- func (c *VirgilCrypto) SignThenEncrypt(data []byte, signerKey interface{ ... }, recipients ...) ([]byte, error)
- func (c *VirgilCrypto) StartPFSSession(ICb, LTCb, OTCb *ed25519PublicKey, ICa, EKa *ed25519PrivateKey, ...) (sess *PFSSession, err error)
- func (c *VirgilCrypto) VerifyHashSignature(hash []byte, signature []byte, key interface{ ... }) error
- func (c *VirgilCrypto) VerifySignature(data []byte, signature []byte, key interface{ ... }) error
- func (c *VirgilCrypto) VerifyStream(in io.Reader, signature []byte, key interface{ ... }) error
- type VirgilHash
- type VirgilPrivateKeyExporter
- type VirgilSigner
- type VirgilStreamCipher
- type VirgilVerifier
- type WrongPasswordError
Constants ¶
View Source
const Curve25519PrivateKeySize = 32
View Source
const Curve25519PublicKeySize = 32
View Source
const EC_PRIVATE_KEY = "PRIVATE KEY"
View Source
const ENCRYPTED_PRIVATE_KEY = "ENCRYPTED PRIVATE KEY"
View Source
const MINIMAL_KEY_LENGTH = 32
View Source
const PUBLIC_KEY = "PUBLIC KEY"
Variables ¶
View Source
var ( OidSha256 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 1} OidSha384 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 2} OidSha512 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 3} )
View Source
var ( // ErrInvalidBlockSize indicates hash blocksize <= 0. ErrInvalidBlockSize = CryptoError("invalid blocksize") // ErrInvalidPKCS7Data indicates bad input to PKCS7 pad or unpad. ErrInvalidPKCS7Data = CryptoError("invalid PKCS7 data (empty or not padded)") // ErrInvalidPKCS7Padding indicates PKCS7 unpad fails to bad input. ErrInvalidPKCS7Padding = CryptoError("invalid padding on input") )
View Source
var DefaultChunkSize = 1024 * 1024
View Source
var NewKeypair func() (*ed25519Keypair, error)
View Source
var UnsupportedKeyErr = CryptoError("key unsupported")
Functions ¶
func DecodePrivateKey ¶
func DecodePublicKey ¶
func EDHRespond ¶
Types ¶
type CMSEnvelope ¶
type CMSEnvelope struct { ContentType asn1.ObjectIdentifier Content envelopedData `asn1:"tag:0,explicit"` }
type Cipher ¶
type Cipher interface { AddKeyRecipient(key *ed25519PublicKey) error AddPasswordRecipient(password []byte) Encrypt(data []byte) ([]byte, error) DecryptWithPassword(data []byte, password []byte) ([]byte, error) DecryptWithPrivateKey(data []byte, key *ed25519PrivateKey) ([]byte, error) EncryptStream(in io.Reader, out io.Writer) error DecryptStream(in io.Reader, out io.Writer, key *ed25519PrivateKey) error SignThenEncrypt(data []byte, signerKey *ed25519PrivateKey) ([]byte, error) DecryptThenVerify(data []byte, decryptionKey *ed25519PrivateKey, verifierPublicKeys ...*ed25519PublicKey) ([]byte, error) }
type CryptoError ¶
type CryptoError string
func (CryptoError) Error ¶
func (c CryptoError) Error() string
type CustomParam ¶
type Envelope ¶
type Envelope struct { Version int Data CMSEnvelope CustomParams []CustomParam `asn1:"set,explicit,optional"` }
type KeyType ¶
type KeyType int
KeyType denotes algorithm used for key generation. See keytypes package
type PFS ¶
type PFS interface { StartPFSSession(ICb, LTCb, OTCb *ed25519PublicKey, ICa, EKa *ed25519PrivateKey, additionalData []byte) (sess *PFSSession, err error) ReceivePFCSession(ICa, EKa *ed25519PublicKey, ICb, LTCb, OTCb *ed25519PrivateKey, additionalData []byte) (sess *PFSSession, err error) }
type PFSSession ¶
func (*PFSSession) Encrypt ¶
func (s *PFSSession) Encrypt(plaintext []byte) (salt, ciphertext []byte)
type StructuralError ¶
type StructuralError struct {
Msg string
}
A StructuralError suggests that the ASN.1 data is valid, but the Go type which is receiving it doesn't match.
func (StructuralError) Error ¶
func (e StructuralError) Error() string
type SyntaxError ¶
type SyntaxError struct {
Msg string
}
A SyntaxError suggests that the ASN.1 data is invalid.
func (SyntaxError) Error ¶
func (e SyntaxError) Error() string
type VirgilAccessTokenSigner ¶
type VirgilAccessTokenSigner struct {
Crypto *VirgilCrypto
}
func NewVirgilAccessTokenSigner ¶
func NewVirgilAccessTokenSigner() *VirgilAccessTokenSigner
func (*VirgilAccessTokenSigner) GenerateTokenSignature ¶
func (*VirgilAccessTokenSigner) GetAlgorithm ¶
func (t *VirgilAccessTokenSigner) GetAlgorithm() string
func (*VirgilAccessTokenSigner) VerifyTokenSignature ¶
type VirgilCardCrypto ¶
type VirgilCardCrypto struct {
Crypto *VirgilCrypto
}
func NewVirgilCardCrypto ¶
func NewVirgilCardCrypto() *VirgilCardCrypto
func (*VirgilCardCrypto) ExportPublicKey ¶
func (c *VirgilCardCrypto) ExportPublicKey(key interface { IsPublic() bool Identifier() []byte }) ([]byte, error)
func (*VirgilCardCrypto) GenerateSHA512 ¶
func (c *VirgilCardCrypto) GenerateSHA512(data []byte) []byte
func (*VirgilCardCrypto) GenerateSignature ¶
func (*VirgilCardCrypto) ImportPublicKey ¶
func (c *VirgilCardCrypto) ImportPublicKey(data []byte) (interface { IsPublic() bool Identifier() []byte }, error)
func (*VirgilCardCrypto) VerifySignature ¶
type VirgilChunkCipher ¶
type VirgilChunkCipher interface { Encrypt(key, nonce, ad []byte, chunkSize int, in io.Reader, out io.Writer) error Decrypt(key, nonce, ad []byte, chunkSize int, in io.Reader, out io.Writer) error }
var ChunkCipher VirgilChunkCipher
type VirgilCrypto ¶
func NewVirgilCrypto ¶
func NewVirgilCrypto() *VirgilCrypto
func (*VirgilCrypto) CalculateIdentifier ¶
func (c *VirgilCrypto) CalculateIdentifier(data []byte) []byte
func (*VirgilCrypto) DecryptStream ¶
func (*VirgilCrypto) DecryptThenVerify ¶
func (*VirgilCrypto) EncryptStream ¶
func (*VirgilCrypto) ExportPrivateKey ¶
func (*VirgilCrypto) ExportPublicKey ¶
func (c *VirgilCrypto) ExportPublicKey(key interface { IsPublic() bool Identifier() []byte }) ([]byte, error)
func (*VirgilCrypto) ExtractPublicKey ¶
func (*VirgilCrypto) GenerateKeypair ¶
func (c *VirgilCrypto) GenerateKeypair() (*ed25519Keypair, error)
func (*VirgilCrypto) ImportPrivateKey ¶
func (*VirgilCrypto) ImportPublicKey ¶
func (c *VirgilCrypto) ImportPublicKey(data []byte) (interface { IsPublic() bool Identifier() []byte }, error)
func (*VirgilCrypto) ReceivePFCSession ¶
func (c *VirgilCrypto) ReceivePFCSession(ICa, EKa *ed25519PublicKey, ICb, LTCb, OTCb *ed25519PrivateKey, additionalData []byte) (sess *PFSSession, err error)
func (*VirgilCrypto) SetKeyType ¶
func (c *VirgilCrypto) SetKeyType(keyType KeyType) error
func (*VirgilCrypto) SignStream ¶
func (*VirgilCrypto) SignThenEncrypt ¶
func (*VirgilCrypto) StartPFSSession ¶
func (c *VirgilCrypto) StartPFSSession(ICb, LTCb, OTCb *ed25519PublicKey, ICa, EKa *ed25519PrivateKey, additionalData []byte) (sess *PFSSession, err error)
func (*VirgilCrypto) VerifyHashSignature ¶
func (*VirgilCrypto) VerifySignature ¶
func (*VirgilCrypto) VerifyStream ¶
type VirgilHash ¶
var Hash VirgilHash
type VirgilPrivateKeyExporter ¶
type VirgilPrivateKeyExporter struct { Crypto *VirgilCrypto Password string }
func NewPrivateKeyExporter ¶
func NewPrivateKeyExporter(password string) *VirgilPrivateKeyExporter
func (*VirgilPrivateKeyExporter) ExportPrivateKey ¶
func (v *VirgilPrivateKeyExporter) ExportPrivateKey(key interface { IsPrivate() bool Identifier() []byte }) ([]byte, error)
func (*VirgilPrivateKeyExporter) ImportPrivateKey ¶
func (v *VirgilPrivateKeyExporter) ImportPrivateKey(data []byte) (interface { IsPrivate() bool Identifier() []byte }, error)
type VirgilSigner ¶
type VirgilSigner interface { Sign(data []byte, signer *ed25519PrivateKey) ([]byte, error) SignHash(hash []byte, signer *ed25519PrivateKey) ([]byte, error) SignStream(data io.Reader, signer *ed25519PrivateKey) ([]byte, error) }
var Signer VirgilSigner
type VirgilStreamCipher ¶
type VirgilStreamCipher interface { Encrypt(key, nonce, ad []byte, in io.Reader, out io.Writer) error Decrypt(key, nonce, ad []byte, in io.Reader, out io.Writer) error }
var StreamCipher VirgilStreamCipher
type VirgilVerifier ¶
type VirgilVerifier interface { Verify(data []byte, key *ed25519PublicKey, signature []byte) error VerifyHash(hash []byte, key *ed25519PublicKey, signature []byte) error VerifyStream(data io.Reader, key *ed25519PublicKey, signature []byte) error }
var Verifier VirgilVerifier
type WrongPasswordError ¶
type WrongPasswordError struct {
CryptoError
}
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package ed25519 implements the Ed25519 signature algorithm.
|
Package ed25519 implements the Ed25519 signature algorithm. |
edwards25519
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519.
|
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519. |
Click to show internal directories.
Click to hide internal directories.