Documentation ¶
Index ¶
- Constants
- func Base64Decode(str []byte) ([]byte, error)
- func Base64DecodedLen(strLen uint) uint
- func Base64Encode(data []byte) []byte
- func Base64EncodedLen(dataLen uint) uint
- func FoundationErrorHandleStatus(status C.vscf_status_t) error
- func OidEqual(lhs []byte, rhs []byte) bool
- func OidFromAlgId(algId AlgId) []byte
- func OidFromId(oidId OidId) []byte
- func PemTitle(pem []byte) []byte
- func PemUnwrap(pem []byte) ([]byte, error)
- func PemUnwrappedLen(pemLen uint) uint
- func PemWrap(title string, data []byte) []byte
- func PemWrappedLen(title string, dataLen uint) uint
- type Aes256Cbc
- func (obj *Aes256Cbc) AlgId() AlgId
- func (obj *Aes256Cbc) Ctx() uintptr
- func (obj *Aes256Cbc) Decrypt(data []byte) ([]byte, error)
- func (obj *Aes256Cbc) DecryptedLen(dataLen uint) uint
- func (obj *Aes256Cbc) DecryptedOutLen(dataLen uint) uint
- func (obj *Aes256Cbc) Delete()
- func (obj *Aes256Cbc) Encrypt(data []byte) ([]byte, error)
- func (obj *Aes256Cbc) EncryptedLen(dataLen uint) uint
- func (obj *Aes256Cbc) EncryptedOutLen(dataLen uint) uint
- func (obj *Aes256Cbc) Finish() ([]byte, error)
- func (obj *Aes256Cbc) GetBlockLen() uint
- func (obj *Aes256Cbc) GetKeyBitlen() uint
- func (obj *Aes256Cbc) GetKeyLen() uint
- func (obj *Aes256Cbc) GetNonceLen() uint
- func (obj *Aes256Cbc) OutLen(dataLen uint) uint
- func (obj *Aes256Cbc) PreciseEncryptedLen(dataLen uint) uint
- func (obj *Aes256Cbc) ProduceAlgInfo() (AlgInfo, error)
- func (obj *Aes256Cbc) RestoreAlgInfo(algInfo AlgInfo) error
- func (obj *Aes256Cbc) SetKey(key []byte)
- func (obj *Aes256Cbc) SetNonce(nonce []byte)
- func (obj *Aes256Cbc) StartDecryption()
- func (obj *Aes256Cbc) StartEncryption()
- func (obj *Aes256Cbc) Update(data []byte) []byte
- type Aes256Gcm
- func (obj *Aes256Gcm) AlgId() AlgId
- func (obj *Aes256Gcm) AuthDecrypt(data []byte, authData []byte, tag []byte) ([]byte, error)
- func (obj *Aes256Gcm) AuthDecryptedLen(dataLen uint) uint
- func (obj *Aes256Gcm) AuthEncrypt(data []byte, authData []byte) ([]byte, []byte, error)
- func (obj *Aes256Gcm) AuthEncryptedLen(dataLen uint) uint
- func (obj *Aes256Gcm) Ctx() uintptr
- func (obj *Aes256Gcm) Decrypt(data []byte) ([]byte, error)
- func (obj *Aes256Gcm) DecryptedLen(dataLen uint) uint
- func (obj *Aes256Gcm) DecryptedOutLen(dataLen uint) uint
- func (obj *Aes256Gcm) Delete()
- func (obj *Aes256Gcm) Encrypt(data []byte) ([]byte, error)
- func (obj *Aes256Gcm) EncryptedLen(dataLen uint) uint
- func (obj *Aes256Gcm) EncryptedOutLen(dataLen uint) uint
- func (obj *Aes256Gcm) Finish() ([]byte, error)
- func (obj *Aes256Gcm) FinishAuthDecryption(tag []byte) ([]byte, error)
- func (obj *Aes256Gcm) FinishAuthEncryption() ([]byte, []byte, error)
- func (obj *Aes256Gcm) GetAuthTagLen() uint
- func (obj *Aes256Gcm) GetBlockLen() uint
- func (obj *Aes256Gcm) GetKeyBitlen() uint
- func (obj *Aes256Gcm) GetKeyLen() uint
- func (obj *Aes256Gcm) GetNonceLen() uint
- func (obj *Aes256Gcm) OutLen(dataLen uint) uint
- func (obj *Aes256Gcm) PreciseEncryptedLen(dataLen uint) uint
- func (obj *Aes256Gcm) ProduceAlgInfo() (AlgInfo, error)
- func (obj *Aes256Gcm) RestoreAlgInfo(algInfo AlgInfo) error
- func (obj *Aes256Gcm) SetAuthData(authData []byte)
- func (obj *Aes256Gcm) SetKey(key []byte)
- func (obj *Aes256Gcm) SetNonce(nonce []byte)
- func (obj *Aes256Gcm) StartDecryption()
- func (obj *Aes256Gcm) StartEncryption()
- func (obj *Aes256Gcm) Update(data []byte) []byte
- type Alg
- type AlgFactory
- type AlgId
- type AlgInfo
- type AlgInfoDerDeserializer
- func (obj *AlgInfoDerDeserializer) Ctx() uintptr
- func (obj *AlgInfoDerDeserializer) Delete()
- func (obj *AlgInfoDerDeserializer) Deserialize(data []byte) (AlgInfo, error)
- func (obj *AlgInfoDerDeserializer) DeserializeInplace() (AlgInfo, error)
- func (obj *AlgInfoDerDeserializer) SetAsn1Reader(asn1Reader Asn1Reader)
- func (obj *AlgInfoDerDeserializer) SetupDefaults()
- type AlgInfoDerSerializer
- func (obj *AlgInfoDerSerializer) Ctx() uintptr
- func (obj *AlgInfoDerSerializer) Delete()
- func (obj *AlgInfoDerSerializer) Serialize(algInfo AlgInfo) []byte
- func (obj *AlgInfoDerSerializer) SerializeInplace(algInfo AlgInfo) uint
- func (obj *AlgInfoDerSerializer) SerializedLen(algInfo AlgInfo) uint
- func (obj *AlgInfoDerSerializer) SetAsn1Writer(asn1Writer Asn1Writer)
- func (obj *AlgInfoDerSerializer) SetupDefaults()
- type AlgInfoDeserializer
- type AlgInfoSerializer
- type Asn1Reader
- type Asn1Tag
- type Asn1Writer
- type Asn1rd
- func (obj *Asn1rd) Ctx() uintptr
- func (obj *Asn1rd) Delete()
- func (obj *Asn1rd) GetDataLen() uint
- func (obj *Asn1rd) GetLen() uint
- func (obj *Asn1rd) GetTag() int32
- func (obj *Asn1rd) HasError() bool
- func (obj *Asn1rd) LeftLen() uint
- func (obj *Asn1rd) ReadBitstringAsOctetStr() []byte
- func (obj *Asn1rd) ReadBool() bool
- func (obj *Asn1rd) ReadContextTag(tag int32) uint
- func (obj *Asn1rd) ReadData(len uint) []byte
- func (obj *Asn1rd) ReadInt() int32
- func (obj *Asn1rd) ReadInt16() int16
- func (obj *Asn1rd) ReadInt32() int32
- func (obj *Asn1rd) ReadInt64() int64
- func (obj *Asn1rd) ReadInt8() int8
- func (obj *Asn1rd) ReadNull()
- func (obj *Asn1rd) ReadNullOptional()
- func (obj *Asn1rd) ReadOctetStr() []byte
- func (obj *Asn1rd) ReadOid() []byte
- func (obj *Asn1rd) ReadSequence() uint
- func (obj *Asn1rd) ReadSet() uint
- func (obj *Asn1rd) ReadTag(tag int32) uint
- func (obj *Asn1rd) ReadUint() uint32
- func (obj *Asn1rd) ReadUint16() uint16
- func (obj *Asn1rd) ReadUint32() uint32
- func (obj *Asn1rd) ReadUint64() uint64
- func (obj *Asn1rd) ReadUint8() uint8
- func (obj *Asn1rd) ReadUtf8Str() []byte
- func (obj *Asn1rd) Reset(data []byte)
- func (obj *Asn1rd) Status() error
- type Asn1wr
- func (obj *Asn1wr) Bytes() unsafe.Pointer
- func (obj *Asn1wr) Ctx() uintptr
- func (obj *Asn1wr) Delete()
- func (obj *Asn1wr) Finish(doNotAdjust bool) uint
- func (obj *Asn1wr) HasError() bool
- func (obj *Asn1wr) Len() uint
- func (obj *Asn1wr) Reserve(len uint) unsafe.Pointer
- func (obj *Asn1wr) Reset(out []byte, outLen uint)
- func (obj *Asn1wr) Status() error
- func (obj *Asn1wr) UnwrittenLen() uint
- func (obj *Asn1wr) WriteBool(value bool) uint
- func (obj *Asn1wr) WriteContextTag(tag int32, len uint) uint
- func (obj *Asn1wr) WriteData(data []byte) uint
- func (obj *Asn1wr) WriteInt(value int32) uint
- func (obj *Asn1wr) WriteInt16(value int16) uint
- func (obj *Asn1wr) WriteInt32(value int32) uint
- func (obj *Asn1wr) WriteInt64(value int64) uint
- func (obj *Asn1wr) WriteInt8(value int8) uint
- func (obj *Asn1wr) WriteLen(len uint) uint
- func (obj *Asn1wr) WriteNull() uint
- func (obj *Asn1wr) WriteOctetStr(value []byte) uint
- func (obj *Asn1wr) WriteOctetStrAsBitstring(value []byte) uint
- func (obj *Asn1wr) WriteOid(value []byte) uint
- func (obj *Asn1wr) WriteSequence(len uint) uint
- func (obj *Asn1wr) WriteSet(len uint) uint
- func (obj *Asn1wr) WriteTag(tag int32) uint
- func (obj *Asn1wr) WriteUint(value uint32) uint
- func (obj *Asn1wr) WriteUint16(value uint16) uint
- func (obj *Asn1wr) WriteUint32(value uint32) uint
- func (obj *Asn1wr) WriteUint64(value uint64) uint
- func (obj *Asn1wr) WriteUint8(value uint8) uint
- func (obj *Asn1wr) WriteUtf8Str(value []byte) uint
- func (obj *Asn1wr) WrittenLen() uint
- type AuthDecrypt
- type AuthEncrypt
- type Base64
- type BrainkeyClient
- func (obj *BrainkeyClient) Blind(password []byte) ([]byte, []byte, error)
- func (obj *BrainkeyClient) Ctx() uintptr
- func (obj *BrainkeyClient) Deblind(password []byte, hardenedPoint []byte, deblindFactor []byte, keyName []byte) ([]byte, error)
- func (obj *BrainkeyClient) Delete()
- func (obj *BrainkeyClient) SetOperationRandom(operationRandom Random)
- func (obj *BrainkeyClient) SetRandom(random Random)
- func (obj *BrainkeyClient) SetupDefaults() error
- type BrainkeyServer
- func (obj *BrainkeyServer) Ctx() uintptr
- func (obj *BrainkeyServer) Delete()
- func (obj *BrainkeyServer) GenerateIdentitySecret() ([]byte, error)
- func (obj *BrainkeyServer) Harden(identitySecret []byte, blindedPoint []byte) ([]byte, error)
- func (obj *BrainkeyServer) SetOperationRandom(operationRandom Random)
- func (obj *BrainkeyServer) SetRandom(random Random)
- func (obj *BrainkeyServer) SetupDefaults() error
- type Cipher
- type CipherAlgInfo
- type CipherAuth
- type CipherAuthInfo
- type CipherInfo
- type CipherState
- type CompoundKeyAlg
- func (obj *CompoundKeyAlg) AlgId() AlgId
- func (obj *CompoundKeyAlg) CanDecrypt(privateKey PrivateKey, dataLen uint) bool
- func (obj *CompoundKeyAlg) CanEncrypt(publicKey PublicKey, dataLen uint) bool
- func (obj *CompoundKeyAlg) CanSign(privateKey PrivateKey) bool
- func (obj *CompoundKeyAlg) CanVerify(publicKey PublicKey) bool
- func (obj *CompoundKeyAlg) Ctx() uintptr
- func (obj *CompoundKeyAlg) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
- func (obj *CompoundKeyAlg) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
- func (obj *CompoundKeyAlg) Delete()
- func (obj *CompoundKeyAlg) Encrypt(publicKey PublicKey, data []byte) ([]byte, error)
- func (obj *CompoundKeyAlg) EncryptedLen(publicKey PublicKey, dataLen uint) uint
- func (obj *CompoundKeyAlg) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
- func (obj *CompoundKeyAlg) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
- func (obj *CompoundKeyAlg) GenerateEphemeralKey(key Key) (PrivateKey, error)
- func (obj *CompoundKeyAlg) GetCanExportPrivateKey() bool
- func (obj *CompoundKeyAlg) GetCanExportPublicKey() bool
- func (obj *CompoundKeyAlg) GetCanImportPrivateKey() bool
- func (obj *CompoundKeyAlg) GetCanImportPublicKey() bool
- func (obj *CompoundKeyAlg) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
- func (obj *CompoundKeyAlg) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
- func (obj *CompoundKeyAlg) MakeKey(cipherKey PrivateKey, signerKey PrivateKey) (PrivateKey, error)
- func (obj *CompoundKeyAlg) ProduceAlgInfo() (AlgInfo, error)
- func (obj *CompoundKeyAlg) RestoreAlgInfo(algInfo AlgInfo) error
- func (obj *CompoundKeyAlg) SetRandom(random Random)
- func (obj *CompoundKeyAlg) SetupDefaults() error
- func (obj *CompoundKeyAlg) SignHash(privateKey PrivateKey, hashId AlgId, digest []byte) ([]byte, error)
- func (obj *CompoundKeyAlg) SignatureLen(privateKey PrivateKey) uint
- func (obj *CompoundKeyAlg) VerifyHash(publicKey PublicKey, hashId AlgId, digest []byte, signature []byte) bool
- type CompoundKeyAlgInfo
- type CompoundPrivateKey
- func (obj *CompoundPrivateKey) AlgId() AlgId
- func (obj *CompoundPrivateKey) AlgInfo() (AlgInfo, error)
- func (obj *CompoundPrivateKey) Bitlen() uint
- func (obj *CompoundPrivateKey) CipherKey() (PrivateKey, error)
- func (obj *CompoundPrivateKey) Ctx() uintptr
- func (obj *CompoundPrivateKey) Delete()
- func (obj *CompoundPrivateKey) ExtractPublicKey() (PublicKey, error)
- func (obj *CompoundPrivateKey) IsValid() bool
- func (obj *CompoundPrivateKey) Len() uint
- func (obj *CompoundPrivateKey) SignerKey() (PrivateKey, error)
- type CompoundPublicKey
- func (obj *CompoundPublicKey) AlgId() AlgId
- func (obj *CompoundPublicKey) AlgInfo() (AlgInfo, error)
- func (obj *CompoundPublicKey) Bitlen() uint
- func (obj *CompoundPublicKey) CipherKey() (PublicKey, error)
- func (obj *CompoundPublicKey) Ctx() uintptr
- func (obj *CompoundPublicKey) Delete()
- func (obj *CompoundPublicKey) IsValid() bool
- func (obj *CompoundPublicKey) Len() uint
- func (obj *CompoundPublicKey) SignerKey() (PublicKey, error)
- type ComputeSharedKey
- type CtrDrbg
- func (obj *CtrDrbg) Ctx() uintptr
- func (obj *CtrDrbg) Delete()
- func (obj *CtrDrbg) EnablePredictionResistance()
- func (obj *CtrDrbg) Random(dataLen uint) ([]byte, error)
- func (obj *CtrDrbg) Reseed() error
- func (obj *CtrDrbg) SetEntropyLen(len uint)
- func (obj *CtrDrbg) SetEntropySource(entropySource EntropySource) error
- func (obj *CtrDrbg) SetReseedInterval(interval uint)
- func (obj *CtrDrbg) SetupDefaults() error
- type Curve25519
- func (obj *Curve25519) CanDecrypt(privateKey PrivateKey, dataLen uint) bool
- func (obj *Curve25519) CanEncrypt(publicKey PublicKey, dataLen uint) bool
- func (obj *Curve25519) ComputeSharedKey(publicKey PublicKey, privateKey PrivateKey) ([]byte, error)
- func (obj *Curve25519) Ctx() uintptr
- func (obj *Curve25519) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
- func (obj *Curve25519) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
- func (obj *Curve25519) Delete()
- func (obj *Curve25519) Encrypt(publicKey PublicKey, data []byte) ([]byte, error)
- func (obj *Curve25519) EncryptedLen(publicKey PublicKey, dataLen uint) uint
- func (obj *Curve25519) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
- func (obj *Curve25519) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
- func (obj *Curve25519) GenerateEphemeralKey(key Key) (PrivateKey, error)
- func (obj *Curve25519) GenerateKey() (PrivateKey, error)
- func (obj *Curve25519) GetCanExportPrivateKey() bool
- func (obj *Curve25519) GetCanExportPublicKey() bool
- func (obj *Curve25519) GetCanImportPrivateKey() bool
- func (obj *Curve25519) GetCanImportPublicKey() bool
- func (obj *Curve25519) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
- func (obj *Curve25519) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
- func (obj *Curve25519) KemDecapsulate(encapsulatedKey []byte, privateKey PrivateKey) ([]byte, error)
- func (obj *Curve25519) KemEncapsulate(publicKey PublicKey) ([]byte, []byte, error)
- func (obj *Curve25519) KemEncapsulatedKeyLen(publicKey PublicKey) uint
- func (obj *Curve25519) KemSharedKeyLen(key Key) uint
- func (obj *Curve25519) SetEcies(ecies *Ecies)
- func (obj *Curve25519) SetRandom(random Random)
- func (obj *Curve25519) SetupDefaults() error
- func (obj *Curve25519) SharedKeyLen(key Key) uint
- type Decrypt
- type Ecc
- func (obj *Ecc) CanDecrypt(privateKey PrivateKey, dataLen uint) bool
- func (obj *Ecc) CanEncrypt(publicKey PublicKey, dataLen uint) bool
- func (obj *Ecc) CanSign(privateKey PrivateKey) bool
- func (obj *Ecc) CanVerify(publicKey PublicKey) bool
- func (obj *Ecc) ComputeSharedKey(publicKey PublicKey, privateKey PrivateKey) ([]byte, error)
- func (obj *Ecc) Ctx() uintptr
- func (obj *Ecc) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
- func (obj *Ecc) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
- func (obj *Ecc) Delete()
- func (obj *Ecc) Encrypt(publicKey PublicKey, data []byte) ([]byte, error)
- func (obj *Ecc) EncryptedLen(publicKey PublicKey, dataLen uint) uint
- func (obj *Ecc) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
- func (obj *Ecc) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
- func (obj *Ecc) GenerateEphemeralKey(key Key) (PrivateKey, error)
- func (obj *Ecc) GenerateKey(algId AlgId) (PrivateKey, error)
- func (obj *Ecc) GetCanExportPrivateKey() bool
- func (obj *Ecc) GetCanExportPublicKey() bool
- func (obj *Ecc) GetCanImportPrivateKey() bool
- func (obj *Ecc) GetCanImportPublicKey() bool
- func (obj *Ecc) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
- func (obj *Ecc) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
- func (obj *Ecc) KemDecapsulate(encapsulatedKey []byte, privateKey PrivateKey) ([]byte, error)
- func (obj *Ecc) KemEncapsulate(publicKey PublicKey) ([]byte, []byte, error)
- func (obj *Ecc) KemEncapsulatedKeyLen(publicKey PublicKey) uint
- func (obj *Ecc) KemSharedKeyLen(key Key) uint
- func (obj *Ecc) SetEcies(ecies *Ecies)
- func (obj *Ecc) SetRandom(random Random)
- func (obj *Ecc) SetupDefaults() error
- func (obj *Ecc) SharedKeyLen(key Key) uint
- func (obj *Ecc) SignHash(privateKey PrivateKey, hashId AlgId, digest []byte) ([]byte, error)
- func (obj *Ecc) SignatureLen(privateKey PrivateKey) uint
- func (obj *Ecc) VerifyHash(publicKey PublicKey, hashId AlgId, digest []byte, signature []byte) bool
- type EccAlgInfo
- type EccPrivateKey
- func (obj *EccPrivateKey) AlgId() AlgId
- func (obj *EccPrivateKey) AlgInfo() (AlgInfo, error)
- func (obj *EccPrivateKey) Bitlen() uint
- func (obj *EccPrivateKey) Ctx() uintptr
- func (obj *EccPrivateKey) Delete()
- func (obj *EccPrivateKey) ExtractPublicKey() (PublicKey, error)
- func (obj *EccPrivateKey) IsValid() bool
- func (obj *EccPrivateKey) Len() uint
- type EccPublicKey
- type Ecies
- func (obj *Ecies) Ctx() uintptr
- func (obj *Ecies) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
- func (obj *Ecies) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
- func (obj *Ecies) Delete()
- func (obj *Ecies) Encrypt(publicKey PublicKey, data []byte) ([]byte, error)
- func (obj *Ecies) EncryptedLen(publicKey PublicKey, dataLen uint) uint
- func (obj *Ecies) ReleaseKeyAlg()
- func (obj *Ecies) SetCipher(cipher Cipher)
- func (obj *Ecies) SetEphemeralKey(ephemeralKey PrivateKey)
- func (obj *Ecies) SetKdf(kdf Kdf)
- func (obj *Ecies) SetKeyAlg(keyAlg KeyAlg)
- func (obj *Ecies) SetMac(mac Mac)
- func (obj *Ecies) SetRandom(random Random)
- func (obj *Ecies) SetupDefaults() error
- func (obj *Ecies) SetupDefaultsNoRandom()
- type Ed25519
- func (obj *Ed25519) CanDecrypt(privateKey PrivateKey, dataLen uint) bool
- func (obj *Ed25519) CanEncrypt(publicKey PublicKey, dataLen uint) bool
- func (obj *Ed25519) CanSign(privateKey PrivateKey) bool
- func (obj *Ed25519) CanVerify(publicKey PublicKey) bool
- func (obj *Ed25519) ComputeSharedKey(publicKey PublicKey, privateKey PrivateKey) ([]byte, error)
- func (obj *Ed25519) Ctx() uintptr
- func (obj *Ed25519) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
- func (obj *Ed25519) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
- func (obj *Ed25519) Delete()
- func (obj *Ed25519) Encrypt(publicKey PublicKey, data []byte) ([]byte, error)
- func (obj *Ed25519) EncryptedLen(publicKey PublicKey, dataLen uint) uint
- func (obj *Ed25519) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
- func (obj *Ed25519) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
- func (obj *Ed25519) GenerateEphemeralKey(key Key) (PrivateKey, error)
- func (obj *Ed25519) GenerateKey() (PrivateKey, error)
- func (obj *Ed25519) GetCanExportPrivateKey() bool
- func (obj *Ed25519) GetCanExportPublicKey() bool
- func (obj *Ed25519) GetCanImportPrivateKey() bool
- func (obj *Ed25519) GetCanImportPublicKey() bool
- func (obj *Ed25519) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
- func (obj *Ed25519) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
- func (obj *Ed25519) KemDecapsulate(encapsulatedKey []byte, privateKey PrivateKey) ([]byte, error)
- func (obj *Ed25519) KemEncapsulate(publicKey PublicKey) ([]byte, []byte, error)
- func (obj *Ed25519) KemEncapsulatedKeyLen(publicKey PublicKey) uint
- func (obj *Ed25519) KemSharedKeyLen(key Key) uint
- func (obj *Ed25519) SetEcies(ecies *Ecies)
- func (obj *Ed25519) SetRandom(random Random)
- func (obj *Ed25519) SetupDefaults() error
- func (obj *Ed25519) SharedKeyLen(key Key) uint
- func (obj *Ed25519) SignHash(privateKey PrivateKey, hashId AlgId, digest []byte) ([]byte, error)
- func (obj *Ed25519) SignatureLen(privateKey PrivateKey) uint
- func (obj *Ed25519) VerifyHash(publicKey PublicKey, hashId AlgId, digest []byte, signature []byte) bool
- type Encrypt
- type EntropyAccumulator
- func (obj *EntropyAccumulator) AddSource(source EntropySource, threshold uint)
- func (obj *EntropyAccumulator) Ctx() uintptr
- func (obj *EntropyAccumulator) Delete()
- func (obj *EntropyAccumulator) Gather(len uint) ([]byte, error)
- func (obj *EntropyAccumulator) IsStrong() bool
- func (obj *EntropyAccumulator) SetupDefaults()
- type EntropySource
- type FakeRandom
- func (obj *FakeRandom) Ctx() uintptr
- func (obj *FakeRandom) Delete()
- func (obj *FakeRandom) Gather(len uint) ([]byte, error)
- func (obj *FakeRandom) IsStrong() bool
- func (obj *FakeRandom) Random(dataLen uint) ([]byte, error)
- func (obj *FakeRandom) Reseed() error
- func (obj *FakeRandom) SetupSourceByte(byteSource byte)
- func (obj *FakeRandom) SetupSourceData(dataSource []byte)
- type Falcon
- func (obj *Falcon) AlgId() AlgId
- func (obj *Falcon) CanSign(privateKey PrivateKey) bool
- func (obj *Falcon) CanVerify(publicKey PublicKey) bool
- func (obj *Falcon) Ctx() uintptr
- func (obj *Falcon) Delete()
- func (obj *Falcon) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
- func (obj *Falcon) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
- func (obj *Falcon) GenerateEphemeralKey(key Key) (PrivateKey, error)
- func (obj *Falcon) GenerateKey() (PrivateKey, error)
- func (obj *Falcon) GetCanExportPrivateKey() bool
- func (obj *Falcon) GetCanExportPublicKey() bool
- func (obj *Falcon) GetCanImportPrivateKey() bool
- func (obj *Falcon) GetCanImportPublicKey() bool
- func (obj *Falcon) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
- func (obj *Falcon) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
- func (obj *Falcon) ProduceAlgInfo() (AlgInfo, error)
- func (obj *Falcon) RestoreAlgInfo(algInfo AlgInfo) error
- func (obj *Falcon) SetRandom(random Random)
- func (obj *Falcon) SetupDefaults() error
- func (obj *Falcon) SignHash(privateKey PrivateKey, hashId AlgId, digest []byte) ([]byte, error)
- func (obj *Falcon) SignatureLen(privateKey PrivateKey) uint
- func (obj *Falcon) VerifyHash(publicKey PublicKey, hashId AlgId, digest []byte, signature []byte) bool
- type FooterInfo
- type FoundationError
- type FoundationImplementation
- type GroupMsgType
- type GroupSession
- func (obj *GroupSession) AddEpoch(message *GroupSessionMessage) error
- func (obj *GroupSession) CreateGroupTicket() (*GroupSessionTicket, error)
- func (obj *GroupSession) Ctx() uintptr
- func (obj *GroupSession) Decrypt(message *GroupSessionMessage, publicKey PublicKey) ([]byte, error)
- func (obj *GroupSession) DecryptLen(message *GroupSessionMessage) uint
- func (obj *GroupSession) Delete()
- func (obj *GroupSession) Encrypt(plainText []byte, privateKey PrivateKey) (*GroupSessionMessage, error)
- func (obj *GroupSession) GetCurrentEpoch() uint32
- func (obj *GroupSession) GetSessionId() []byte
- func (obj *GroupSession) SetRng(rng Random)
- func (obj *GroupSession) SetupDefaults() error
- type GroupSessionMessage
- func (obj *GroupSessionMessage) Ctx() uintptr
- func (obj *GroupSessionMessage) Delete()
- func (obj *GroupSessionMessage) GetEpoch() uint32
- func (obj *GroupSessionMessage) GetSessionId() []byte
- func (obj *GroupSessionMessage) GetType() GroupMsgType
- func (obj *GroupSessionMessage) Serialize() []byte
- func (obj *GroupSessionMessage) SerializeLen() uint
- type GroupSessionTicket
- func (obj *GroupSessionTicket) Ctx() uintptr
- func (obj *GroupSessionTicket) Delete()
- func (obj *GroupSessionTicket) GetTicketMessage() *GroupSessionMessage
- func (obj *GroupSessionTicket) SetRng(rng Random)
- func (obj *GroupSessionTicket) SetupDefaults() error
- func (obj *GroupSessionTicket) SetupTicketAsNew(sessionId []byte) error
- type Hash
- type HashBasedAlgInfo
- type Hkdf
- func (obj *Hkdf) AlgId() AlgId
- func (obj *Hkdf) Ctx() uintptr
- func (obj *Hkdf) Delete()
- func (obj *Hkdf) Derive(data []byte, keyLen uint) []byte
- func (obj *Hkdf) ProduceAlgInfo() (AlgInfo, error)
- func (obj *Hkdf) Reset(salt []byte, iterationCount uint)
- func (obj *Hkdf) RestoreAlgInfo(algInfo AlgInfo) error
- func (obj *Hkdf) SetHash(hash Hash)
- func (obj *Hkdf) SetInfo(info []byte)
- type Hmac
- func (obj *Hmac) AlgId() AlgId
- func (obj *Hmac) Ctx() uintptr
- func (obj *Hmac) Delete()
- func (obj *Hmac) DigestLen() uint
- func (obj *Hmac) Finish() []byte
- func (obj *Hmac) Mac(key []byte, data []byte) []byte
- func (obj *Hmac) ProduceAlgInfo() (AlgInfo, error)
- func (obj *Hmac) Reset()
- func (obj *Hmac) RestoreAlgInfo(algInfo AlgInfo) error
- func (obj *Hmac) SetHash(hash Hash)
- func (obj *Hmac) Start(key []byte)
- func (obj *Hmac) Update(data []byte)
- type HybridKeyAlg
- func (obj *HybridKeyAlg) CanDecrypt(privateKey PrivateKey, dataLen uint) bool
- func (obj *HybridKeyAlg) CanEncrypt(publicKey PublicKey, dataLen uint) bool
- func (obj *HybridKeyAlg) CanSign(privateKey PrivateKey) bool
- func (obj *HybridKeyAlg) CanVerify(publicKey PublicKey) bool
- func (obj *HybridKeyAlg) Ctx() uintptr
- func (obj *HybridKeyAlg) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
- func (obj *HybridKeyAlg) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
- func (obj *HybridKeyAlg) Delete()
- func (obj *HybridKeyAlg) Encrypt(publicKey PublicKey, data []byte) ([]byte, error)
- func (obj *HybridKeyAlg) EncryptedLen(publicKey PublicKey, dataLen uint) uint
- func (obj *HybridKeyAlg) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
- func (obj *HybridKeyAlg) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
- func (obj *HybridKeyAlg) GenerateEphemeralKey(key Key) (PrivateKey, error)
- func (obj *HybridKeyAlg) GetCanExportPrivateKey() bool
- func (obj *HybridKeyAlg) GetCanExportPublicKey() bool
- func (obj *HybridKeyAlg) GetCanImportPrivateKey() bool
- func (obj *HybridKeyAlg) GetCanImportPublicKey() bool
- func (obj *HybridKeyAlg) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
- func (obj *HybridKeyAlg) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
- func (obj *HybridKeyAlg) MakeKey(firstKey PrivateKey, secondKey PrivateKey) (PrivateKey, error)
- func (obj *HybridKeyAlg) SetCipher(cipher CipherAuth)
- func (obj *HybridKeyAlg) SetHash(hash Hash)
- func (obj *HybridKeyAlg) SetRandom(random Random)
- func (obj *HybridKeyAlg) SetupDefaults() error
- func (obj *HybridKeyAlg) SignHash(privateKey PrivateKey, hashId AlgId, digest []byte) ([]byte, error)
- func (obj *HybridKeyAlg) SignatureLen(privateKey PrivateKey) uint
- func (obj *HybridKeyAlg) VerifyHash(publicKey PublicKey, hashId AlgId, digest []byte, signature []byte) bool
- type HybridKeyAlgInfo
- type HybridPrivateKey
- func (obj *HybridPrivateKey) AlgId() AlgId
- func (obj *HybridPrivateKey) AlgInfo() (AlgInfo, error)
- func (obj *HybridPrivateKey) Bitlen() uint
- func (obj *HybridPrivateKey) Ctx() uintptr
- func (obj *HybridPrivateKey) Delete()
- func (obj *HybridPrivateKey) ExtractPublicKey() (PublicKey, error)
- func (obj *HybridPrivateKey) FirstKey() (PrivateKey, error)
- func (obj *HybridPrivateKey) IsValid() bool
- func (obj *HybridPrivateKey) Len() uint
- func (obj *HybridPrivateKey) SecondKey() (PrivateKey, error)
- type HybridPublicKey
- func (obj *HybridPublicKey) AlgId() AlgId
- func (obj *HybridPublicKey) AlgInfo() (AlgInfo, error)
- func (obj *HybridPublicKey) Bitlen() uint
- func (obj *HybridPublicKey) Ctx() uintptr
- func (obj *HybridPublicKey) Delete()
- func (obj *HybridPublicKey) FirstKey() (PublicKey, error)
- func (obj *HybridPublicKey) IsValid() bool
- func (obj *HybridPublicKey) Len() uint
- func (obj *HybridPublicKey) SecondKey() (PublicKey, error)
- type Kdf
- type Kdf1
- type Kdf2
- type Kem
- type Key
- type KeyAlg
- func FoundationImplementationWrapKeyAlg(ctx *C.vscf_impl_t) (KeyAlg, error)
- func KeyAlgFactoryCreateFromAlgId(algId AlgId, random Random) (KeyAlg, error)
- func KeyAlgFactoryCreateFromKey(key Key, random Random) (KeyAlg, error)
- func KeyAlgFactoryCreateFromRawPrivateKey(privateKey *RawPrivateKey, random Random) (KeyAlg, error)
- func KeyAlgFactoryCreateFromRawPublicKey(publicKey *RawPublicKey, random Random) (KeyAlg, error)
- type KeyAlgFactory
- type KeyAsn1Deserializer
- func (obj *KeyAsn1Deserializer) Ctx() uintptr
- func (obj *KeyAsn1Deserializer) Delete()
- func (obj *KeyAsn1Deserializer) DeserializePrivateKey(privateKeyData []byte) (*RawPrivateKey, error)
- func (obj *KeyAsn1Deserializer) DeserializePrivateKeyInplace() (*RawPrivateKey, error)
- func (obj *KeyAsn1Deserializer) DeserializePublicKey(publicKeyData []byte) (*RawPublicKey, error)
- func (obj *KeyAsn1Deserializer) DeserializePublicKeyInplace() (*RawPublicKey, error)
- func (obj *KeyAsn1Deserializer) SetAsn1Reader(asn1Reader Asn1Reader)
- func (obj *KeyAsn1Deserializer) SetupDefaults()
- type KeyAsn1Serializer
- func (obj *KeyAsn1Serializer) Ctx() uintptr
- func (obj *KeyAsn1Serializer) Delete()
- func (obj *KeyAsn1Serializer) SerializePrivateKey(privateKey *RawPrivateKey) ([]byte, error)
- func (obj *KeyAsn1Serializer) SerializePrivateKeyInplace(privateKey *RawPrivateKey) (uint, error)
- func (obj *KeyAsn1Serializer) SerializePublicKey(publicKey *RawPublicKey) ([]byte, error)
- func (obj *KeyAsn1Serializer) SerializePublicKeyInplace(publicKey *RawPublicKey) (uint, error)
- func (obj *KeyAsn1Serializer) SerializedPrivateKeyLen(privateKey *RawPrivateKey) uint
- func (obj *KeyAsn1Serializer) SerializedPublicKeyLen(publicKey *RawPublicKey) uint
- func (obj *KeyAsn1Serializer) SetAsn1Writer(asn1Writer Asn1Writer)
- func (obj *KeyAsn1Serializer) SetupDefaults()
- type KeyCipher
- type KeyDeserializer
- type KeyInfo
- func (obj *KeyInfo) AlgId() AlgId
- func (obj *KeyInfo) CompoundCipherAlgId() AlgId
- func (obj *KeyInfo) CompoundHybridCipherFirstKeyAlgId() AlgId
- func (obj *KeyInfo) CompoundHybridCipherSecondKeyAlgId() AlgId
- func (obj *KeyInfo) CompoundHybridSignerFirstKeyAlgId() AlgId
- func (obj *KeyInfo) CompoundHybridSignerSecondKeyAlgId() AlgId
- func (obj *KeyInfo) CompoundSignerAlgId() AlgId
- func (obj *KeyInfo) Ctx() uintptr
- func (obj *KeyInfo) Delete()
- func (obj *KeyInfo) HybridFirstKeyAlgId() AlgId
- func (obj *KeyInfo) HybridSecondKeyAlgId() AlgId
- func (obj *KeyInfo) IsCompound() bool
- func (obj *KeyInfo) IsCompoundHybrid() bool
- func (obj *KeyInfo) IsCompoundHybridCipher() bool
- func (obj *KeyInfo) IsCompoundHybridSigner() bool
- func (obj *KeyInfo) IsHybrid() bool
- func (obj *KeyInfo) IsHybridPostQuantum() bool
- func (obj *KeyInfo) IsHybridPostQuantumCipher() bool
- func (obj *KeyInfo) IsHybridPostQuantumSigner() bool
- type KeyMaterialRng
- type KeyProvider
- func (obj *KeyProvider) Ctx() uintptr
- func (obj *KeyProvider) Delete()
- func (obj *KeyProvider) ExportPrivateKey(privateKey PrivateKey) ([]byte, error)
- func (obj *KeyProvider) ExportPublicKey(publicKey PublicKey) ([]byte, error)
- func (obj *KeyProvider) ExportedPrivateKeyLen(privateKey PrivateKey) uint
- func (obj *KeyProvider) ExportedPublicKeyLen(publicKey PublicKey) uint
- func (obj *KeyProvider) GenerateCompoundHybridPrivateKey(cipherFirstKeyAlgId AlgId, cipherSecondKeyAlgId AlgId, ...) (PrivateKey, error)
- func (obj *KeyProvider) GenerateCompoundPrivateKey(cipherAlgId AlgId, signerAlgId AlgId) (PrivateKey, error)
- func (obj *KeyProvider) GenerateHybridPrivateKey(firstKeyAlgId AlgId, secondKeyAlgId AlgId) (PrivateKey, error)
- func (obj *KeyProvider) GeneratePostQuantumPrivateKey() (PrivateKey, error)
- func (obj *KeyProvider) GeneratePrivateKey(algId AlgId) (PrivateKey, error)
- func (obj *KeyProvider) ImportPrivateKey(keyData []byte) (PrivateKey, error)
- func (obj *KeyProvider) ImportPublicKey(keyData []byte) (PublicKey, error)
- func (obj *KeyProvider) SetRandom(random Random)
- func (obj *KeyProvider) SetRsaParams(bitlen uint)
- func (obj *KeyProvider) SetupDefaults() error
- type KeyRecipientInfo
- type KeyRecipientInfoList
- func (obj *KeyRecipientInfoList) Clear()
- func (obj *KeyRecipientInfoList) Ctx() uintptr
- func (obj *KeyRecipientInfoList) Delete()
- func (obj *KeyRecipientInfoList) HasItem() bool
- func (obj *KeyRecipientInfoList) HasNext() bool
- func (obj *KeyRecipientInfoList) HasPrev() bool
- func (obj *KeyRecipientInfoList) Item() *KeyRecipientInfo
- func (obj *KeyRecipientInfoList) Next() *KeyRecipientInfoList
- func (obj *KeyRecipientInfoList) Prev() *KeyRecipientInfoList
- type KeySerializer
- type KeySigner
- type Mac
- type MessageInfo
- func (obj *MessageInfo) CipherKdfAlgInfo() (AlgInfo, error)
- func (obj *MessageInfo) CipherPaddingAlgInfo() (AlgInfo, error)
- func (obj *MessageInfo) Clear()
- func (obj *MessageInfo) Ctx() uintptr
- func (obj *MessageInfo) CustomParams() *MessageInfoCustomParams
- func (obj *MessageInfo) DataEncryptionAlgInfo() (AlgInfo, error)
- func (obj *MessageInfo) Delete()
- func (obj *MessageInfo) FooterInfo() *FooterInfo
- func (obj *MessageInfo) HasCipherKdfAlgInfo() bool
- func (obj *MessageInfo) HasCipherPaddingAlgInfo() bool
- func (obj *MessageInfo) HasCustomParams() bool
- func (obj *MessageInfo) HasFooterInfo() bool
- func (obj *MessageInfo) KeyRecipientInfoList() *KeyRecipientInfoList
- func (obj *MessageInfo) PasswordRecipientInfoList() *PasswordRecipientInfoList
- type MessageInfoCustomParams
- func (obj *MessageInfoCustomParams) AddData(key []byte, value []byte)
- func (obj *MessageInfoCustomParams) AddInt(key []byte, value int32)
- func (obj *MessageInfoCustomParams) AddString(key []byte, value []byte)
- func (obj *MessageInfoCustomParams) Clear()
- func (obj *MessageInfoCustomParams) Ctx() uintptr
- func (obj *MessageInfoCustomParams) Delete()
- func (obj *MessageInfoCustomParams) FindData(key []byte) ([]byte, error)
- func (obj *MessageInfoCustomParams) FindInt(key []byte) (int32, error)
- func (obj *MessageInfoCustomParams) FindString(key []byte) ([]byte, error)
- func (obj *MessageInfoCustomParams) HasParams() bool
- type MessageInfoDerSerializer
- func (obj *MessageInfoDerSerializer) Ctx() uintptr
- func (obj *MessageInfoDerSerializer) Delete()
- func (obj *MessageInfoDerSerializer) Deserialize(data []byte) (*MessageInfo, error)
- func (obj *MessageInfoDerSerializer) DeserializeFooter(data []byte) (*MessageInfoFooter, error)
- func (obj *MessageInfoDerSerializer) GetPrefixLen() uint
- func (obj *MessageInfoDerSerializer) ReadPrefix(data []byte) uint
- func (obj *MessageInfoDerSerializer) Serialize(messageInfo *MessageInfo) []byte
- func (obj *MessageInfoDerSerializer) SerializeFooter(messageInfoFooter *MessageInfoFooter) []byte
- func (obj *MessageInfoDerSerializer) SerializedFooterLen(messageInfoFooter *MessageInfoFooter) uint
- func (obj *MessageInfoDerSerializer) SerializedLen(messageInfo *MessageInfo) uint
- func (obj *MessageInfoDerSerializer) SetAsn1Reader(asn1Reader Asn1Reader)
- func (obj *MessageInfoDerSerializer) SetAsn1Writer(asn1Writer Asn1Writer)
- func (obj *MessageInfoDerSerializer) SetupDefaults()
- type MessageInfoEditor
- func (obj *MessageInfoEditor) AddKeyRecipient(recipientId []byte, publicKey PublicKey) error
- func (obj *MessageInfoEditor) Ctx() uintptr
- func (obj *MessageInfoEditor) Delete()
- func (obj *MessageInfoEditor) Pack() []byte
- func (obj *MessageInfoEditor) PackedLen() uint
- func (obj *MessageInfoEditor) RemoveAll()
- func (obj *MessageInfoEditor) RemoveKeyRecipient(recipientId []byte) bool
- func (obj *MessageInfoEditor) SetRandom(random Random)
- func (obj *MessageInfoEditor) SetupDefaults() error
- func (obj *MessageInfoEditor) Unlock(ownerRecipientId []byte, ownerPrivateKey PrivateKey) error
- func (obj *MessageInfoEditor) Unpack(messageInfoData []byte) error
- type MessageInfoFooter
- func (obj *MessageInfoFooter) Ctx() uintptr
- func (obj *MessageInfoFooter) Delete()
- func (obj *MessageInfoFooter) HasSignerInfos() bool
- func (obj *MessageInfoFooter) SignerDigest() []byte
- func (obj *MessageInfoFooter) SignerHashAlgInfo() (AlgInfo, error)
- func (obj *MessageInfoFooter) SignerInfos() *SignerInfoList
- type MessageInfoFooterSerializer
- type MessageInfoSerializer
- type Oid
- type OidId
- type Padding
- type PaddingParams
- type PasswordRecipientInfo
- type PasswordRecipientInfoList
- func (obj *PasswordRecipientInfoList) Clear()
- func (obj *PasswordRecipientInfoList) Ctx() uintptr
- func (obj *PasswordRecipientInfoList) Delete()
- func (obj *PasswordRecipientInfoList) HasItem() bool
- func (obj *PasswordRecipientInfoList) HasNext() bool
- func (obj *PasswordRecipientInfoList) HasPrev() bool
- func (obj *PasswordRecipientInfoList) Item() *PasswordRecipientInfo
- func (obj *PasswordRecipientInfoList) Next() *PasswordRecipientInfoList
- func (obj *PasswordRecipientInfoList) Prev() *PasswordRecipientInfoList
- type PbeAlgInfo
- type Pem
- type Pkcs5Pbes2
- func (obj *Pkcs5Pbes2) AlgId() AlgId
- func (obj *Pkcs5Pbes2) Ctx() uintptr
- func (obj *Pkcs5Pbes2) Decrypt(data []byte) ([]byte, error)
- func (obj *Pkcs5Pbes2) DecryptedLen(dataLen uint) uint
- func (obj *Pkcs5Pbes2) Delete()
- func (obj *Pkcs5Pbes2) Encrypt(data []byte) ([]byte, error)
- func (obj *Pkcs5Pbes2) EncryptedLen(dataLen uint) uint
- func (obj *Pkcs5Pbes2) PreciseEncryptedLen(dataLen uint) uint
- func (obj *Pkcs5Pbes2) ProduceAlgInfo() (AlgInfo, error)
- func (obj *Pkcs5Pbes2) Reset(pwd []byte)
- func (obj *Pkcs5Pbes2) RestoreAlgInfo(algInfo AlgInfo) error
- func (obj *Pkcs5Pbes2) SetCipher(cipher Cipher)
- func (obj *Pkcs5Pbes2) SetKdf(kdf SaltedKdf)
- type Pkcs5Pbkdf2
- func (obj *Pkcs5Pbkdf2) AlgId() AlgId
- func (obj *Pkcs5Pbkdf2) Ctx() uintptr
- func (obj *Pkcs5Pbkdf2) Delete()
- func (obj *Pkcs5Pbkdf2) Derive(data []byte, keyLen uint) []byte
- func (obj *Pkcs5Pbkdf2) ProduceAlgInfo() (AlgInfo, error)
- func (obj *Pkcs5Pbkdf2) Reset(salt []byte, iterationCount uint)
- func (obj *Pkcs5Pbkdf2) RestoreAlgInfo(algInfo AlgInfo) error
- func (obj *Pkcs5Pbkdf2) SetHmac(hmac Mac)
- func (obj *Pkcs5Pbkdf2) SetInfo(info []byte)
- func (obj *Pkcs5Pbkdf2) SetupDefaults()
- type Pkcs8Serializer
- func (obj *Pkcs8Serializer) Ctx() uintptr
- func (obj *Pkcs8Serializer) Delete()
- func (obj *Pkcs8Serializer) SerializePrivateKey(privateKey *RawPrivateKey) ([]byte, error)
- func (obj *Pkcs8Serializer) SerializePrivateKeyInplace(privateKey *RawPrivateKey) (uint, error)
- func (obj *Pkcs8Serializer) SerializePublicKey(publicKey *RawPublicKey) ([]byte, error)
- func (obj *Pkcs8Serializer) SerializePublicKeyInplace(publicKey *RawPublicKey) (uint, error)
- func (obj *Pkcs8Serializer) SerializedPrivateKeyLen(privateKey *RawPrivateKey) uint
- func (obj *Pkcs8Serializer) SerializedPublicKeyLen(publicKey *RawPublicKey) uint
- func (obj *Pkcs8Serializer) SetAsn1Writer(asn1Writer Asn1Writer)
- func (obj *Pkcs8Serializer) SetupDefaults()
- type PrivateKey
- type PublicKey
- type Random
- type RandomPadding
- func (obj *RandomPadding) AlgId() AlgId
- func (obj *RandomPadding) Configure(params *PaddingParams)
- func (obj *RandomPadding) Ctx() uintptr
- func (obj *RandomPadding) Delete()
- func (obj *RandomPadding) FinishDataProcessing() ([]byte, error)
- func (obj *RandomPadding) FinishPaddedDataProcessing() ([]byte, error)
- func (obj *RandomPadding) FinishPaddedDataProcessingOutLen() uint
- func (obj *RandomPadding) Len() uint
- func (obj *RandomPadding) LenMax() uint
- func (obj *RandomPadding) PaddedDataLen(dataLen uint) uint
- func (obj *RandomPadding) ProcessData(data []byte) []byte
- func (obj *RandomPadding) ProcessPaddedData(data []byte) []byte
- func (obj *RandomPadding) ProduceAlgInfo() (AlgInfo, error)
- func (obj *RandomPadding) RestoreAlgInfo(algInfo AlgInfo) error
- func (obj *RandomPadding) SetRandom(random Random)
- func (obj *RandomPadding) StartDataProcessing()
- func (obj *RandomPadding) StartPaddedDataProcessing()
- type RawPrivateKey
- func (obj *RawPrivateKey) AlgId() AlgId
- func (obj *RawPrivateKey) AlgInfo() (AlgInfo, error)
- func (obj *RawPrivateKey) Bitlen() uint
- func (obj *RawPrivateKey) Ctx() uintptr
- func (obj *RawPrivateKey) Data() []byte
- func (obj *RawPrivateKey) Delete()
- func (obj *RawPrivateKey) ExtractPublicKey() (PublicKey, error)
- func (obj *RawPrivateKey) GetPublicKey() *RawPublicKey
- func (obj *RawPrivateKey) HasPublicKey() bool
- func (obj *RawPrivateKey) IsValid() bool
- func (obj *RawPrivateKey) Len() uint
- func (obj *RawPrivateKey) SetPublicKey(rawPublicKey *RawPublicKey)
- type RawPublicKey
- func (obj *RawPublicKey) AlgId() AlgId
- func (obj *RawPublicKey) AlgInfo() (AlgInfo, error)
- func (obj *RawPublicKey) Bitlen() uint
- func (obj *RawPublicKey) Ctx() uintptr
- func (obj *RawPublicKey) Data() []byte
- func (obj *RawPublicKey) Delete()
- func (obj *RawPublicKey) IsValid() bool
- func (obj *RawPublicKey) Len() uint
- type RecipientCipher
- func (obj *RecipientCipher) AddKeyRecipient(recipientId []byte, publicKey PublicKey)
- func (obj *RecipientCipher) AddSigner(signerId []byte, privateKey PrivateKey) error
- func (obj *RecipientCipher) ClearRecipients()
- func (obj *RecipientCipher) ClearSigners()
- func (obj *RecipientCipher) Ctx() uintptr
- func (obj *RecipientCipher) CustomParams() *MessageInfoCustomParams
- func (obj *RecipientCipher) DecryptionOutLen(dataLen uint) uint
- func (obj *RecipientCipher) Delete()
- func (obj *RecipientCipher) EncryptionOutLen(dataLen uint) uint
- func (obj *RecipientCipher) FinishDecryption() ([]byte, error)
- func (obj *RecipientCipher) FinishEncryption() ([]byte, error)
- func (obj *RecipientCipher) HasKeyRecipient(recipientId []byte) bool
- func (obj *RecipientCipher) IsDataSigned() bool
- func (obj *RecipientCipher) MessageInfoFooterLen() uint
- func (obj *RecipientCipher) MessageInfoLen() uint
- func (obj *RecipientCipher) PackMessageInfo() []byte
- func (obj *RecipientCipher) PackMessageInfoFooter() ([]byte, error)
- func (obj *RecipientCipher) ProcessDecryption(data []byte) ([]byte, error)
- func (obj *RecipientCipher) ProcessEncryption(data []byte) ([]byte, error)
- func (obj *RecipientCipher) SetEncryptionCipher(encryptionCipher Cipher)
- func (obj *RecipientCipher) SetEncryptionPadding(encryptionPadding Padding)
- func (obj *RecipientCipher) SetPaddingParams(paddingParams *PaddingParams)
- func (obj *RecipientCipher) SetRandom(random Random)
- func (obj *RecipientCipher) SetSignerHash(signerHash Hash)
- func (obj *RecipientCipher) SignerInfos() *SignerInfoList
- func (obj *RecipientCipher) StartDecryptionWithKey(recipientId []byte, privateKey PrivateKey, messageInfo []byte) error
- func (obj *RecipientCipher) StartEncryption() error
- func (obj *RecipientCipher) StartSignedEncryption(dataSize uint) error
- func (obj *RecipientCipher) StartVerifiedDecryptionWithKey(recipientId []byte, privateKey PrivateKey, messageInfo []byte, ...) error
- func (obj *RecipientCipher) VerifySignerInfo(signerInfo *SignerInfo, publicKey PublicKey) bool
- type Round5
- func (obj *Round5) Ctx() uintptr
- func (obj *Round5) Delete()
- func (obj *Round5) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
- func (obj *Round5) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
- func (obj *Round5) GenerateEphemeralKey(key Key) (PrivateKey, error)
- func (obj *Round5) GenerateKey(algId AlgId) (PrivateKey, error)
- func (obj *Round5) GetCanExportPrivateKey() bool
- func (obj *Round5) GetCanExportPublicKey() bool
- func (obj *Round5) GetCanImportPrivateKey() bool
- func (obj *Round5) GetCanImportPublicKey() bool
- func (obj *Round5) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
- func (obj *Round5) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
- func (obj *Round5) KemDecapsulate(encapsulatedKey []byte, privateKey PrivateKey) ([]byte, error)
- func (obj *Round5) KemEncapsulate(publicKey PublicKey) ([]byte, []byte, error)
- func (obj *Round5) KemEncapsulatedKeyLen(publicKey PublicKey) uint
- func (obj *Round5) KemSharedKeyLen(key Key) uint
- func (obj *Round5) SetRandom(random Random)
- func (obj *Round5) SetupDefaults() error
- type Rsa
- func (obj *Rsa) CanDecrypt(privateKey PrivateKey, dataLen uint) bool
- func (obj *Rsa) CanEncrypt(publicKey PublicKey, dataLen uint) bool
- func (obj *Rsa) CanSign(privateKey PrivateKey) bool
- func (obj *Rsa) CanVerify(publicKey PublicKey) bool
- func (obj *Rsa) Ctx() uintptr
- func (obj *Rsa) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
- func (obj *Rsa) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
- func (obj *Rsa) Delete()
- func (obj *Rsa) Encrypt(publicKey PublicKey, data []byte) ([]byte, error)
- func (obj *Rsa) EncryptedLen(publicKey PublicKey, dataLen uint) uint
- func (obj *Rsa) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
- func (obj *Rsa) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
- func (obj *Rsa) GenerateEphemeralKey(key Key) (PrivateKey, error)
- func (obj *Rsa) GenerateKey(bitlen uint) (PrivateKey, error)
- func (obj *Rsa) GetCanExportPrivateKey() bool
- func (obj *Rsa) GetCanExportPublicKey() bool
- func (obj *Rsa) GetCanImportPrivateKey() bool
- func (obj *Rsa) GetCanImportPublicKey() bool
- func (obj *Rsa) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
- func (obj *Rsa) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
- func (obj *Rsa) SetRandom(random Random)
- func (obj *Rsa) SetupDefaults() error
- func (obj *Rsa) SignHash(privateKey PrivateKey, hashId AlgId, digest []byte) ([]byte, error)
- func (obj *Rsa) SignatureLen(privateKey PrivateKey) uint
- func (obj *Rsa) VerifyHash(publicKey PublicKey, hashId AlgId, digest []byte, signature []byte) bool
- type RsaPrivateKey
- func (obj *RsaPrivateKey) AlgId() AlgId
- func (obj *RsaPrivateKey) AlgInfo() (AlgInfo, error)
- func (obj *RsaPrivateKey) Bitlen() uint
- func (obj *RsaPrivateKey) Ctx() uintptr
- func (obj *RsaPrivateKey) Delete()
- func (obj *RsaPrivateKey) ExtractPublicKey() (PublicKey, error)
- func (obj *RsaPrivateKey) IsValid() bool
- func (obj *RsaPrivateKey) Len() uint
- type RsaPublicKey
- func (obj *RsaPublicKey) AlgId() AlgId
- func (obj *RsaPublicKey) AlgInfo() (AlgInfo, error)
- func (obj *RsaPublicKey) Bitlen() uint
- func (obj *RsaPublicKey) Ctx() uintptr
- func (obj *RsaPublicKey) Delete()
- func (obj *RsaPublicKey) IsValid() bool
- func (obj *RsaPublicKey) KeyExponent() uint
- func (obj *RsaPublicKey) Len() uint
- type SaltedKdf
- type SaltedKdfAlgInfo
- type Sec1Serializer
- func (obj *Sec1Serializer) Ctx() uintptr
- func (obj *Sec1Serializer) Delete()
- func (obj *Sec1Serializer) SerializePrivateKey(privateKey *RawPrivateKey) ([]byte, error)
- func (obj *Sec1Serializer) SerializePrivateKeyInplace(privateKey *RawPrivateKey) (uint, error)
- func (obj *Sec1Serializer) SerializePublicKey(publicKey *RawPublicKey) ([]byte, error)
- func (obj *Sec1Serializer) SerializePublicKeyInplace(publicKey *RawPublicKey) (uint, error)
- func (obj *Sec1Serializer) SerializedPrivateKeyLen(privateKey *RawPrivateKey) uint
- func (obj *Sec1Serializer) SerializedPublicKeyLen(publicKey *RawPublicKey) uint
- func (obj *Sec1Serializer) SetAsn1Writer(asn1Writer Asn1Writer)
- func (obj *Sec1Serializer) SetupDefaults()
- type SeedEntropySource
- type Sha224
- func (obj *Sha224) AlgId() AlgId
- func (obj *Sha224) Ctx() uintptr
- func (obj *Sha224) Delete()
- func (obj *Sha224) Finish() []byte
- func (obj *Sha224) GetBlockLen() uint
- func (obj *Sha224) GetDigestLen() uint
- func (obj *Sha224) Hash(data []byte) []byte
- func (obj *Sha224) ProduceAlgInfo() (AlgInfo, error)
- func (obj *Sha224) RestoreAlgInfo(algInfo AlgInfo) error
- func (obj *Sha224) Start()
- func (obj *Sha224) Update(data []byte)
- type Sha256
- func (obj *Sha256) AlgId() AlgId
- func (obj *Sha256) Ctx() uintptr
- func (obj *Sha256) Delete()
- func (obj *Sha256) Finish() []byte
- func (obj *Sha256) GetBlockLen() uint
- func (obj *Sha256) GetDigestLen() uint
- func (obj *Sha256) Hash(data []byte) []byte
- func (obj *Sha256) ProduceAlgInfo() (AlgInfo, error)
- func (obj *Sha256) RestoreAlgInfo(algInfo AlgInfo) error
- func (obj *Sha256) Start()
- func (obj *Sha256) Update(data []byte)
- type Sha384
- func (obj *Sha384) AlgId() AlgId
- func (obj *Sha384) Ctx() uintptr
- func (obj *Sha384) Delete()
- func (obj *Sha384) Finish() []byte
- func (obj *Sha384) GetBlockLen() uint
- func (obj *Sha384) GetDigestLen() uint
- func (obj *Sha384) Hash(data []byte) []byte
- func (obj *Sha384) ProduceAlgInfo() (AlgInfo, error)
- func (obj *Sha384) RestoreAlgInfo(algInfo AlgInfo) error
- func (obj *Sha384) Start()
- func (obj *Sha384) Update(data []byte)
- type Sha512
- func (obj *Sha512) AlgId() AlgId
- func (obj *Sha512) Ctx() uintptr
- func (obj *Sha512) Delete()
- func (obj *Sha512) Finish() []byte
- func (obj *Sha512) GetBlockLen() uint
- func (obj *Sha512) GetDigestLen() uint
- func (obj *Sha512) Hash(data []byte) []byte
- func (obj *Sha512) ProduceAlgInfo() (AlgInfo, error)
- func (obj *Sha512) RestoreAlgInfo(algInfo AlgInfo) error
- func (obj *Sha512) Start()
- func (obj *Sha512) Update(data []byte)
- type SignedDataInfo
- type Signer
- func (obj *Signer) AppendData(data []byte)
- func (obj *Signer) Ctx() uintptr
- func (obj *Signer) Delete()
- func (obj *Signer) Reset()
- func (obj *Signer) SetHash(hash Hash)
- func (obj *Signer) SetRandom(random Random)
- func (obj *Signer) Sign(privateKey PrivateKey) ([]byte, error)
- func (obj *Signer) SignatureLen(privateKey PrivateKey) uint
- type SignerInfo
- type SignerInfoList
- func (obj *SignerInfoList) Clear()
- func (obj *SignerInfoList) Ctx() uintptr
- func (obj *SignerInfoList) Delete()
- func (obj *SignerInfoList) HasItem() bool
- func (obj *SignerInfoList) HasNext() bool
- func (obj *SignerInfoList) HasPrev() bool
- func (obj *SignerInfoList) Item() *SignerInfo
- func (obj *SignerInfoList) Next() *SignerInfoList
- func (obj *SignerInfoList) Prev() *SignerInfoList
- type SimpleAlgInfo
- type Verifier
Constants ¶
const ( BrainkeyClientPointLen uint = 65 BrainkeyClientMpiLen uint = 32 BrainkeyClientSeedLen uint = 32 BrainkeyClientMaxPasswordLen uint = 128 BrainkeyClientMaxKeyNameLen uint = 128 )
const ( BrainkeyServerPointLen uint = 65 BrainkeyServerMpiLen uint = 32 )
const ( /* * The interval before reseed is performed by default. */ CtrDrbgReseedInterval uint = 10000 /* * The amount of entropy used per seed by default. */ CtrDrbgEntropyLen uint = 48 )
const ( /* * This error should not be returned if assertions is enabled. */ FoundationErrorErrorBadArguments int = -1 /* * Can be used to define that not all context prerequisites are satisfied. * Note, this error should not be returned if assertions is enabled. */ FoundationErrorErrorUninitialized int = -2 /* * Define that error code from one of third-party module was not handled. * Note, this error should not be returned if assertions is enabled. */ FoundationErrorErrorUnhandledThirdpartyError int = -3 /* * Buffer capacity is not enough to hold result. */ FoundationErrorErrorSmallBuffer int = -101 /* * Unsupported algorithm. */ FoundationErrorErrorUnsupportedAlgorithm int = -200 /* * Authentication failed during decryption. */ FoundationErrorErrorAuthFailed int = -201 /* * Attempt to read data out of buffer bounds. */ FoundationErrorErrorOutOfData int = -202 /* * ASN.1 encoded data is corrupted. */ FoundationErrorErrorBadAsn1 int = -203 /* * Attempt to read ASN.1 type that is bigger then requested C type. */ FoundationErrorErrorAsn1LossyTypeNarrowing int = -204 /* * ASN.1 representation of PKCS#1 public key is corrupted. */ FoundationErrorErrorBadPkcs1PublicKey int = -205 /* * ASN.1 representation of PKCS#1 private key is corrupted. */ FoundationErrorErrorBadPkcs1PrivateKey int = -206 /* * ASN.1 representation of PKCS#8 public key is corrupted. */ FoundationErrorErrorBadPkcs8PublicKey int = -207 /* * ASN.1 representation of PKCS#8 private key is corrupted. */ FoundationErrorErrorBadPkcs8PrivateKey int = -208 /* * Encrypted data is corrupted. */ FoundationErrorErrorBadEncryptedData int = -209 /* * Underlying random operation returns error. */ FoundationErrorErrorRandomFailed int = -210 /* * Generation of the private or secret key failed. */ FoundationErrorErrorKeyGenerationFailed int = -211 /* * One of the entropy sources failed. */ FoundationErrorErrorEntropySourceFailed int = -212 /* * Requested data to be generated is too big. */ FoundationErrorErrorRngRequestedDataTooBig int = -213 /* * Base64 encoded string contains invalid characters. */ FoundationErrorErrorBadBase64 int = -214 /* * PEM data is corrupted. */ FoundationErrorErrorBadPem int = -215 FoundationErrorErrorSharedKeyExchangeFailed int = -216 /* * Ed25519 public key is corrupted. */ FoundationErrorErrorBadEd25519PublicKey int = -217 /* * Ed25519 private key is corrupted. */ FoundationErrorErrorBadEd25519PrivateKey int = -218 /* * CURVE25519 public key is corrupted. */ FoundationErrorErrorBadCurve25519PublicKey int = -219 /* * CURVE25519 private key is corrupted. */ FoundationErrorErrorBadCurve25519PrivateKey int = -220 /* * Elliptic curve public key format is corrupted see RFC 5480. */ FoundationErrorErrorBadSec1PublicKey int = -221 /* * Elliptic curve public key format is corrupted see RFC 5915. */ FoundationErrorErrorBadSec1PrivateKey int = -222 /* * ASN.1 representation of a public key is corrupted. */ FoundationErrorErrorBadDerPublicKey int = -223 /* * ASN.1 representation of a private key is corrupted. */ FoundationErrorErrorBadDerPrivateKey int = -224 /* * Key algorithm does not accept given type of public key. */ FoundationErrorErrorMismatchPublicKeyAndAlgorithm int = -225 /* * Key algorithm does not accept given type of private key. */ FoundationErrorErrorMismatchPrivateKeyAndAlgorithm int = -226 /* * Post-quantum Falcon-Sign public key is corrupted. */ FoundationErrorErrorBadFalconPublicKey int = -227 /* * Post-quantum Falcon-Sign private key is corrupted. */ FoundationErrorErrorBadFalconPrivateKey int = -228 /* * Generic Round5 library error. */ FoundationErrorErrorRound5 int = -229 /* * Post-quantum NIST Round5 public key is corrupted. */ FoundationErrorErrorBadRound5PublicKey int = -230 /* * Post-quantum NIST Round5 private key is corrupted. */ FoundationErrorErrorBadRound5PrivateKey int = -231 /* * Compound public key is corrupted. */ FoundationErrorErrorBadCompoundPublicKey int = -232 /* * Compound private key is corrupted. */ FoundationErrorErrorBadCompoundPrivateKey int = -233 /* * Compound public hybrid key is corrupted. */ FoundationErrorErrorBadHybridPublicKey int = -234 /* * Compound private hybrid key is corrupted. */ FoundationErrorErrorBadHybridPrivateKey int = -235 /* * ASN.1 AlgorithmIdentifer is corrupted. */ FoundationErrorErrorBadAsn1Algorithm int = -236 /* * ASN.1 AlgorithmIdentifer with ECParameters is corrupted. */ FoundationErrorErrorBadAsn1AlgorithmEcc int = -237 /* * ASN.1 AlgorithmIdentifer with CompoundKeyParams is corrupted. */ FoundationErrorErrorBadAsn1AlgorithmCompoundKey int = -238 /* * ASN.1 AlgorithmIdentifer with HybridKeyParams is corrupted. */ FoundationErrorErrorBadAsn1AlgorithmHybridKey int = -239 /* * Decryption failed, because message info was not given explicitly, * and was not part of an encrypted message. */ FoundationErrorErrorNoMessageInfo int = -301 /* * Message Info is corrupted. */ FoundationErrorErrorBadMessageInfo int = -302 /* * Recipient defined with id is not found within message info * during data decryption. */ FoundationErrorErrorKeyRecipientIsNotFound int = -303 /* * Content encryption key can not be decrypted with a given private key. */ FoundationErrorErrorKeyRecipientPrivateKeyIsWrong int = -304 /* * Content encryption key can not be decrypted with a given password. */ FoundationErrorErrorPasswordRecipientPasswordIsWrong int = -305 /* * Custom parameter with a given key is not found within message info. */ FoundationErrorErrorMessageInfoCustomParamNotFound int = -306 /* * A custom parameter with a given key is found, but the requested value * type does not correspond to the actual type. */ FoundationErrorErrorMessageInfoCustomParamTypeMismatch int = -307 /* * Signature format is corrupted. */ FoundationErrorErrorBadSignature int = -308 FoundationErrorErrorBadMessageInfoFooter int = -309 /* * Brainkey password length is out of range. */ FoundationErrorErrorInvalidBrainkeyPasswordLen int = -401 /* * Brainkey number length should be 32 byte. */ FoundationErrorErrorInvalidBrainkeyFactorLen int = -402 /* * Brainkey point length should be 65 bytes. */ FoundationErrorErrorInvalidBrainkeyPointLen int = -403 /* * Brainkey name is out of range. */ FoundationErrorErrorInvalidBrainkeyKeyNameLen int = -404 /* * Brainkey internal error. */ FoundationErrorErrorBrainkeyInternal int = -405 /* * Brainkey point is invalid. */ FoundationErrorErrorBrainkeyInvalidPoint int = -406 /* * Brainkey number buffer length capacity should be >= 32 byte. */ FoundationErrorErrorInvalidBrainkeyFactorBufferLen int = -407 /* * Brainkey point buffer length capacity should be >= 32 byte. */ FoundationErrorErrorInvalidBrainkeyPointBufferLen int = -408 /* * Brainkey seed buffer length capacity should be >= 32 byte. */ FoundationErrorErrorInvalidBrainkeySeedBufferLen int = -409 /* * Brainkey identity secret is invalid. */ FoundationErrorErrorInvalidIdentitySecret int = -410 /* * KEM encapsulated key is invalid or does not correspond to the private key. */ FoundationErrorErrorInvalidKemEncapsulatedKey int = -411 /* * Invalid padding. */ FoundationErrorErrorInvalidPadding int = -501 /* * Protobuf error. */ FoundationErrorErrorProtobuf int = -601 /* * Session id doesnt match. */ FoundationErrorErrorSessionIdDoesntMatch int = -701 /* * Epoch not found. */ FoundationErrorErrorEpochNotFound int = -702 /* * Wrong key type. */ FoundationErrorErrorWrongKeyType int = -703 /* * Invalid signature. */ FoundationErrorErrorInvalidSignature int = -704 /* * Ed25519 error. */ FoundationErrorErrorEd25519 int = -705 /* * Duplicate epoch. */ FoundationErrorErrorDuplicateEpoch int = -706 /* * Plain text too long. */ FoundationErrorErrorPlainTextTooLong int = -707 )
const ( /* * Sender id len */ GroupSessionSenderIdLen uint = 32 /* * Max plain text len */ GroupSessionMaxPlainTextLen uint = 30000 /* * Max epochs count */ GroupSessionMaxEpochsCount uint = 50 /* * Salt size */ GroupSessionSaltSize uint = 32 )
const ( /* * Max message len */ GroupSessionMessageMaxMessageLen uint = 30188 /* * Message version */ GroupSessionMessageMessageVersion uint = 1 )
const ( /* * Minimum length in bytes for the key material. */ KeyMaterialRngKeyMaterialLenMin uint = 32 /* * Maximum length in bytes for the key material. */ KeyMaterialRngKeyMaterialLenMax uint = 512 )
const ( PaddingParamsDefaultFrameMin uint = 32 PaddingParamsDefaultFrame uint = 160 PaddingParamsDefaultFrameMax uint = 256 )
const (
EntropyAccumulatorSourcesMax uint = 15
)
Variables ¶
This section is empty.
Functions ¶
func Base64Decode ¶
* Decode given data from the base64 format.
func Base64DecodedLen ¶
* Calculate length in bytes required to hold a decoded base64 string.
func Base64Encode ¶
* Encode given data to the base64 format. * Note, written buffer is NOT null-terminated.
func Base64EncodedLen ¶
* Calculate length in bytes required to hold an encoded base64 string.
func FoundationErrorHandleStatus ¶
func FoundationErrorHandleStatus(status C.vscf_status_t) error
Check given C status, and if it's not "success" then raise correspond error.
func OidFromAlgId ¶
* Return OID for given algorithm identifier.
func PemUnwrappedLen ¶
* Return length in bytes required to hold unwrapped binary.
func PemWrap ¶
* Takes binary data and wraps it to the simple PEM format - no * additional information just header-base64-footer. * Note, written buffer is NOT null-terminated.
func PemWrappedLen ¶
* Return length in bytes required to hold wrapped PEM format.
Types ¶
type Aes256Cbc ¶
type Aes256Cbc struct {
// contains filtered or unexported fields
}
* Implementation of the symmetric cipher AES-256 bit in a CBC mode. * Note, this implementation contains dynamic memory allocations, * this should be improved in the future releases.
func NewAes256Cbc ¶
func NewAes256Cbc() *Aes256Cbc
func (*Aes256Cbc) DecryptedLen ¶
* Calculate required buffer length to hold the decrypted data.
func (*Aes256Cbc) DecryptedOutLen ¶
* Return buffer length required to hold an output of the methods * "update" or "finish" in an decryption mode. * Pass zero length to define buffer length of the method "finish".
func (*Aes256Cbc) EncryptedLen ¶
* Calculate required buffer length to hold the encrypted data.
func (*Aes256Cbc) EncryptedOutLen ¶
* Return buffer length required to hold an output of the methods * "update" or "finish" in an encryption mode. * Pass zero length to define buffer length of the method "finish".
func (*Aes256Cbc) GetBlockLen ¶
* Cipher block length in bytes.
func (*Aes256Cbc) GetKeyBitlen ¶
* Cipher key length in bits.
func (*Aes256Cbc) GetNonceLen ¶
* Cipher nfonce length or IV length in bytes, or 0 if nonce is not required.
func (*Aes256Cbc) OutLen ¶
* Return buffer length required to hold an output of the methods * "update" or "finish" in an current mode. * Pass zero length to define buffer length of the method "finish".
func (*Aes256Cbc) PreciseEncryptedLen ¶
* Precise length calculation of encrypted data.
func (*Aes256Cbc) ProduceAlgInfo ¶
* Produce object with algorithm information and configuration parameters.
func (*Aes256Cbc) RestoreAlgInfo ¶
* Restore algorithm configuration from the given object.
func (*Aes256Cbc) StartDecryption ¶
func (obj *Aes256Cbc) StartDecryption()
* Start sequential decryption.
func (*Aes256Cbc) StartEncryption ¶
func (obj *Aes256Cbc) StartEncryption()
* Start sequential encryption.
type Aes256Gcm ¶
type Aes256Gcm struct {
// contains filtered or unexported fields
}
* Implementation of the symmetric cipher AES-256 bit in a GCM mode. * Note, this implementation contains dynamic memory allocations, * this should be improved in the future releases.
func NewAes256Gcm ¶
func NewAes256Gcm() *Aes256Gcm
func (*Aes256Gcm) AuthDecrypt ¶
* Decrypt given data. * If 'tag' is not given, then it will be taken from the 'enc'.
func (*Aes256Gcm) AuthDecryptedLen ¶
* Calculate required buffer length to hold the authenticated decrypted data.
func (*Aes256Gcm) AuthEncrypt ¶
* Encrypt given data. * If 'tag' is not given, then it will written to the 'enc'.
func (*Aes256Gcm) AuthEncryptedLen ¶
* Calculate required buffer length to hold the authenticated encrypted data.
func (*Aes256Gcm) DecryptedLen ¶
* Calculate required buffer length to hold the decrypted data.
func (*Aes256Gcm) DecryptedOutLen ¶
* Return buffer length required to hold an output of the methods * "update" or "finish" in an decryption mode. * Pass zero length to define buffer length of the method "finish".
func (*Aes256Gcm) EncryptedLen ¶
* Calculate required buffer length to hold the encrypted data.
func (*Aes256Gcm) EncryptedOutLen ¶
* Return buffer length required to hold an output of the methods * "update" or "finish" in an encryption mode. * Pass zero length to define buffer length of the method "finish".
func (*Aes256Gcm) FinishAuthDecryption ¶
* Accomplish an authenticated decryption with explicitly given tag. * * Note, if authentication tag is a part of an encrypted data then, * method "finish" can be used for simplicity.
func (*Aes256Gcm) FinishAuthEncryption ¶
* Accomplish an authenticated encryption and place tag separately. * * Note, if authentication tag should be added to an encrypted data, * method "finish" can be used.
func (*Aes256Gcm) GetAuthTagLen ¶
* Defines authentication tag length in bytes.
func (*Aes256Gcm) GetBlockLen ¶
* Cipher block length in bytes.
func (*Aes256Gcm) GetKeyBitlen ¶
* Cipher key length in bits.
func (*Aes256Gcm) GetNonceLen ¶
* Cipher nfonce length or IV length in bytes, or 0 if nonce is not required.
func (*Aes256Gcm) OutLen ¶
* Return buffer length required to hold an output of the methods * "update" or "finish" in an current mode. * Pass zero length to define buffer length of the method "finish".
func (*Aes256Gcm) PreciseEncryptedLen ¶
* Precise length calculation of encrypted data.
func (*Aes256Gcm) ProduceAlgInfo ¶
* Produce object with algorithm information and configuration parameters.
func (*Aes256Gcm) RestoreAlgInfo ¶
* Restore algorithm configuration from the given object.
func (*Aes256Gcm) SetAuthData ¶
* Set additional data for for AEAD ciphers.
func (*Aes256Gcm) StartDecryption ¶
func (obj *Aes256Gcm) StartDecryption()
* Start sequential decryption.
func (*Aes256Gcm) StartEncryption ¶
func (obj *Aes256Gcm) StartEncryption()
* Start sequential encryption.
type Alg ¶
type Alg interface { /* * Provide algorithm identificator. */ AlgId() AlgId /* * Produce object with algorithm information and configuration parameters. */ ProduceAlgInfo() (AlgInfo, error) /* * Restore algorithm configuration from the given object. */ RestoreAlgInfo(algInfo AlgInfo) error /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provide interface to persist algorithm information and it parameters * and then restore the algorithm from it.
func FoundationImplementationWrapAlg ¶
func FoundationImplementationWrapAlg(ctx *C.vscf_impl_t) (Alg, error)
Wrap C implementation object to the Go object that implements interface Alg.
type AlgId ¶
type AlgId int
* Define implemented algorithm identificator.
const ( AlgIdNone AlgId = 0 AlgIdSha224 AlgId = 1 AlgIdSha256 AlgId = 2 AlgIdSha384 AlgId = 3 AlgIdSha512 AlgId = 4 AlgIdKdf1 AlgId = 5 AlgIdKdf2 AlgId = 6 AlgIdRsa AlgId = 7 AlgIdEd25519 AlgId = 8 AlgIdCurve25519 AlgId = 9 AlgIdSecp256r1 AlgId = 10 AlgIdAes256Gcm AlgId = 11 AlgIdAes256Cbc AlgId = 12 AlgIdHmac AlgId = 13 AlgIdHkdf AlgId = 14 AlgIdPkcs5Pbkdf2 AlgId = 15 AlgIdPkcs5Pbes2 AlgId = 16 AlgIdCompoundKey AlgId = 17 AlgIdHybridKey AlgId = 18 AlgIdFalcon AlgId = 19 AlgIdRound5Nd5kem5d AlgId = 20 AlgIdRandomPadding AlgId = 21 )
func OidIdToAlgId ¶
* Map oid identifier to the algorithm identifier.
type AlgInfo ¶
type AlgInfo interface { /* * Provide algorithm identificator. */ AlgId() AlgId /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provide details about implemented algorithms.
func FoundationImplementationWrapAlgInfo ¶
func FoundationImplementationWrapAlgInfo(ctx *C.vscf_impl_t) (AlgInfo, error)
Wrap C implementation object to the Go object that implements interface AlgInfo.
type AlgInfoDerDeserializer ¶
type AlgInfoDerDeserializer struct {
// contains filtered or unexported fields
}
* Provide DER deserializer of algorithm information.
func NewAlgInfoDerDeserializer ¶
func NewAlgInfoDerDeserializer() *AlgInfoDerDeserializer
func (*AlgInfoDerDeserializer) Ctx ¶
func (obj *AlgInfoDerDeserializer) Ctx() uintptr
Handle underlying C context.
func (*AlgInfoDerDeserializer) Delete ¶
func (obj *AlgInfoDerDeserializer) Delete()
* Release underlying C context.
func (*AlgInfoDerDeserializer) Deserialize ¶
func (obj *AlgInfoDerDeserializer) Deserialize(data []byte) (AlgInfo, error)
* Deserialize algorithm from the data.
func (*AlgInfoDerDeserializer) DeserializeInplace ¶
func (obj *AlgInfoDerDeserializer) DeserializeInplace() (AlgInfo, error)
* Deserialize by using internal ASN.1 reader. * Note, that caller code is responsible to reset ASN.1 reader with * an input buffer.
func (*AlgInfoDerDeserializer) SetAsn1Reader ¶
func (obj *AlgInfoDerDeserializer) SetAsn1Reader(asn1Reader Asn1Reader)
func (*AlgInfoDerDeserializer) SetupDefaults ¶
func (obj *AlgInfoDerDeserializer) SetupDefaults()
* Setup predefined values to the uninitialized class dependencies.
type AlgInfoDerSerializer ¶
type AlgInfoDerSerializer struct {
// contains filtered or unexported fields
}
* Provide DER serializer of algorithm information.
func NewAlgInfoDerSerializer ¶
func NewAlgInfoDerSerializer() *AlgInfoDerSerializer
func (*AlgInfoDerSerializer) Ctx ¶
func (obj *AlgInfoDerSerializer) Ctx() uintptr
Handle underlying C context.
func (*AlgInfoDerSerializer) Delete ¶
func (obj *AlgInfoDerSerializer) Delete()
* Release underlying C context.
func (*AlgInfoDerSerializer) Serialize ¶
func (obj *AlgInfoDerSerializer) Serialize(algInfo AlgInfo) []byte
* Serialize algorithm info to buffer class.
func (*AlgInfoDerSerializer) SerializeInplace ¶
func (obj *AlgInfoDerSerializer) SerializeInplace(algInfo AlgInfo) uint
* Serialize by using internal ASN.1 writer. * Note, that caller code is responsible to reset ASN.1 writer with * an output buffer.
func (*AlgInfoDerSerializer) SerializedLen ¶
func (obj *AlgInfoDerSerializer) SerializedLen(algInfo AlgInfo) uint
* Return buffer size enough to hold serialized algorithm.
func (*AlgInfoDerSerializer) SetAsn1Writer ¶
func (obj *AlgInfoDerSerializer) SetAsn1Writer(asn1Writer Asn1Writer)
func (*AlgInfoDerSerializer) SetupDefaults ¶
func (obj *AlgInfoDerSerializer) SetupDefaults()
* Setup predefined values to the uninitialized class dependencies.
type AlgInfoDeserializer ¶
type AlgInfoDeserializer interface { /* * Deserialize algorithm from the data. */ Deserialize(data []byte) (AlgInfo, error) /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provide algorithm deserialization.
func FoundationImplementationWrapAlgInfoDeserializer ¶
func FoundationImplementationWrapAlgInfoDeserializer(ctx *C.vscf_impl_t) (AlgInfoDeserializer, error)
Wrap C implementation object to the Go object that implements interface AlgInfoDeserializer.
type AlgInfoSerializer ¶
type AlgInfoSerializer interface { /* * Return buffer size enough to hold serialized algorithm. */ SerializedLen(algInfo AlgInfo) uint /* * Serialize algorithm info to buffer class. */ Serialize(algInfo AlgInfo) []byte /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provide serialization of algorithm
func FoundationImplementationWrapAlgInfoSerializer ¶
func FoundationImplementationWrapAlgInfoSerializer(ctx *C.vscf_impl_t) (AlgInfoSerializer, error)
Wrap C implementation object to the Go object that implements interface AlgInfoSerializer.
type Asn1Reader ¶
type Asn1Reader interface { /* * Reset all internal states and prepare to new ASN.1 reading operations. */ Reset(data []byte) /* * Return length in bytes how many bytes are left for reading. */ LeftLen() uint /* * Return true if status is not "success". */ HasError() bool /* * Return error code. */ Status() error /* * Get tag of the current ASN.1 element. */ GetTag() int32 /* * Get length of the current ASN.1 element. */ GetLen() uint /* * Get length of the current ASN.1 element with tag and length itself. */ GetDataLen() uint /* * Read ASN.1 type: TAG. * Return element length. */ ReadTag(tag int32) uint /* * Read ASN.1 type: context-specific TAG. * Return element length. * Return 0 if current position do not points to the requested tag. */ ReadContextTag(tag int32) uint /* * Read ASN.1 type: INTEGER. */ ReadInt() int32 /* * Read ASN.1 type: INTEGER. */ ReadInt8() int8 /* * Read ASN.1 type: INTEGER. */ ReadInt16() int16 /* * Read ASN.1 type: INTEGER. */ ReadInt32() int32 /* * Read ASN.1 type: INTEGER. */ ReadInt64() int64 /* * Read ASN.1 type: INTEGER. */ ReadUint() uint32 /* * Read ASN.1 type: INTEGER. */ ReadUint8() uint8 /* * Read ASN.1 type: INTEGER. */ ReadUint16() uint16 /* * Read ASN.1 type: INTEGER. */ ReadUint32() uint32 /* * Read ASN.1 type: INTEGER. */ ReadUint64() uint64 /* * Read ASN.1 type: BOOLEAN. */ ReadBool() bool /* * Read ASN.1 type: NULL. */ ReadNull() /* * Read ASN.1 type: NULL, only if it exists. * Note, this method is safe to call even no more data is left for reading. */ ReadNullOptional() /* * Read ASN.1 type: OCTET STRING. */ ReadOctetStr() []byte /* * Read ASN.1 type: BIT STRING. */ ReadBitstringAsOctetStr() []byte /* * Read ASN.1 type: UTF8String. */ ReadUtf8Str() []byte /* * Read ASN.1 type: OID. */ ReadOid() []byte /* * Read raw data of given length. */ ReadData(len uint) []byte /* * Read ASN.1 type: SEQUENCE. * Return element length. */ ReadSequence() uint /* * Read ASN.1 type: SET. * Return element length. */ ReadSet() uint /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provides interface to the ASN.1 reader. * Note, that all "read" methods move reading position forward. * Note, that all "get" do not change reading position.
func FoundationImplementationWrapAsn1Reader ¶
func FoundationImplementationWrapAsn1Reader(ctx *C.vscf_impl_t) (Asn1Reader, error)
Wrap C implementation object to the Go object that implements interface Asn1Reader.
type Asn1Tag ¶
type Asn1Tag int
* ASN.1 constants.
const ( Asn1TagBoolean Asn1Tag = 0x01 Asn1TagInteger Asn1Tag = 0x02 Asn1TagBitString Asn1Tag = 0x03 Asn1TagOctetString Asn1Tag = 0x04 Asn1TagNull Asn1Tag = 0x05 Asn1TagOid Asn1Tag = 0x06 Asn1TagUtf8String Asn1Tag = 0x0C Asn1TagSequence Asn1Tag = 0x10 Asn1TagSet Asn1Tag = 0x11 Asn1TagPrintableString Asn1Tag = 0x13 Asn1TagT61String Asn1Tag = 0x14 Asn1TagIa5String Asn1Tag = 0x16 Asn1TagUtcTime Asn1Tag = 0x17 Asn1TagGeneralizedTime Asn1Tag = 0x18 Asn1TagUniversalString Asn1Tag = 0x1C Asn1TagBmpString Asn1Tag = 0x1E Asn1TagPrimitive Asn1Tag = 0x00 Asn1TagConstructed Asn1Tag = 0x20 Asn1TagContextSpecific Asn1Tag = 0x80 )
type Asn1Writer ¶
type Asn1Writer interface { /* * Reset all internal states and prepare to new ASN.1 writing operations. */ Reset(out []byte, outLen uint) /* * Finalize writing and forbid further operations. * * Note, that ASN.1 structure is always written to the buffer end, and * if argument "do not adjust" is false, then data is moved to the * beginning, otherwise - data is left at the buffer end. * * Returns length of the written bytes. */ Finish(doNotAdjust bool) uint /* * Returns pointer to the inner buffer. */ Bytes() unsafe.Pointer /* * Returns total inner buffer length. */ Len() uint /* * Returns how many bytes were already written to the ASN.1 structure. */ WrittenLen() uint /* * Returns how many bytes are available for writing. */ UnwrittenLen() uint /* * Return true if status is not "success". */ HasError() bool /* * Return error code. */ Status() error /* * Move writing position backward for the given length. * Return current writing position. */ Reserve(len uint) unsafe.Pointer /* * Write ASN.1 tag. * Return count of written bytes. */ WriteTag(tag int32) uint /* * Write context-specific ASN.1 tag. * Return count of written bytes. */ WriteContextTag(tag int32, len uint) uint /* * Write length of the following data. * Return count of written bytes. */ WriteLen(len uint) uint /* * Write ASN.1 type: INTEGER. * Return count of written bytes. */ WriteInt(value int32) uint /* * Write ASN.1 type: INTEGER. * Return count of written bytes. */ WriteInt8(value int8) uint /* * Write ASN.1 type: INTEGER. * Return count of written bytes. */ WriteInt16(value int16) uint /* * Write ASN.1 type: INTEGER. * Return count of written bytes. */ WriteInt32(value int32) uint /* * Write ASN.1 type: INTEGER. * Return count of written bytes. */ WriteInt64(value int64) uint /* * Write ASN.1 type: INTEGER. * Return count of written bytes. */ WriteUint(value uint32) uint /* * Write ASN.1 type: INTEGER. * Return count of written bytes. */ WriteUint8(value uint8) uint /* * Write ASN.1 type: INTEGER. * Return count of written bytes. */ WriteUint16(value uint16) uint /* * Write ASN.1 type: INTEGER. * Return count of written bytes. */ WriteUint32(value uint32) uint /* * Write ASN.1 type: INTEGER. * Return count of written bytes. */ WriteUint64(value uint64) uint /* * Write ASN.1 type: BOOLEAN. * Return count of written bytes. */ WriteBool(value bool) uint /* * Write ASN.1 type: NULL. */ WriteNull() uint /* * Write ASN.1 type: OCTET STRING. * Return count of written bytes. */ WriteOctetStr(value []byte) uint /* * Write ASN.1 type: BIT STRING with all zero unused bits. * * Return count of written bytes. */ WriteOctetStrAsBitstring(value []byte) uint /* * Write raw data directly to the ASN.1 structure. * Return count of written bytes. * Note, use this method carefully. */ WriteData(data []byte) uint /* * Write ASN.1 type: UTF8String. * Return count of written bytes. */ WriteUtf8Str(value []byte) uint /* * Write ASN.1 type: OID. * Return count of written bytes. */ WriteOid(value []byte) uint /* * Mark previously written data of given length as ASN.1 type: SEQUENCE. * Return count of written bytes. */ WriteSequence(len uint) uint /* * Mark previously written data of given length as ASN.1 type: SET. * Return count of written bytes. */ WriteSet(len uint) uint /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provides interface to the ASN.1 writer. * Note, elements are written starting from the buffer ending. * Note, that all "write" methods move writing position backward.
func FoundationImplementationWrapAsn1Writer ¶
func FoundationImplementationWrapAsn1Writer(ctx *C.vscf_impl_t) (Asn1Writer, error)
Wrap C implementation object to the Go object that implements interface Asn1Writer.
type Asn1rd ¶
type Asn1rd struct {
// contains filtered or unexported fields
}
* This is MbedTLS implementation of ASN.1 reader.
func (*Asn1rd) GetDataLen ¶
* Get length of the current ASN.1 element with tag and length itself.
func (*Asn1rd) ReadBitstringAsOctetStr ¶
* Read ASN.1 type: BIT STRING.
func (*Asn1rd) ReadContextTag ¶
* Read ASN.1 type: context-specific TAG. * Return element length. * Return 0 if current position do not points to the requested tag.
func (*Asn1rd) ReadNullOptional ¶
func (obj *Asn1rd) ReadNullOptional()
* Read ASN.1 type: NULL, only if it exists. * Note, this method is safe to call even no more data is left for reading.
func (*Asn1rd) ReadOctetStr ¶
* Read ASN.1 type: OCTET STRING.
func (*Asn1rd) ReadSequence ¶
* Read ASN.1 type: SEQUENCE. * Return element length.
type Asn1wr ¶
type Asn1wr struct {
// contains filtered or unexported fields
}
* This is MbedTLS implementation of ASN.1 writer.
func (*Asn1wr) Finish ¶
* Finalize writing and forbid further operations. * * Note, that ASN.1 structure is always written to the buffer end, and * if argument "do not adjust" is false, then data is moved to the * beginning, otherwise - data is left at the buffer end. * * Returns length of the written bytes.
func (*Asn1wr) Reserve ¶
* Move writing position backward for the given length. * Return current writing position.
func (*Asn1wr) UnwrittenLen ¶
* Returns how many bytes are available for writing.
func (*Asn1wr) WriteContextTag ¶
* Write context-specific ASN.1 tag. * Return count of written bytes.
func (*Asn1wr) WriteData ¶
* Write raw data directly to the ASN.1 structure. * Return count of written bytes. * Note, use this method carefully.
func (*Asn1wr) WriteInt16 ¶
* Write ASN.1 type: INTEGER. * Return count of written bytes.
func (*Asn1wr) WriteInt32 ¶
* Write ASN.1 type: INTEGER. * Return count of written bytes.
func (*Asn1wr) WriteInt64 ¶
* Write ASN.1 type: INTEGER. * Return count of written bytes.
func (*Asn1wr) WriteOctetStr ¶
* Write ASN.1 type: OCTET STRING. * Return count of written bytes.
func (*Asn1wr) WriteOctetStrAsBitstring ¶
* Write ASN.1 type: BIT STRING with all zero unused bits. * * Return count of written bytes.
func (*Asn1wr) WriteSequence ¶
* Mark previously written data of given length as ASN.1 type: SEQUENCE. * Return count of written bytes.
func (*Asn1wr) WriteSet ¶
* Mark previously written data of given length as ASN.1 type: SET. * Return count of written bytes.
func (*Asn1wr) WriteUint16 ¶
* Write ASN.1 type: INTEGER. * Return count of written bytes.
func (*Asn1wr) WriteUint32 ¶
* Write ASN.1 type: INTEGER. * Return count of written bytes.
func (*Asn1wr) WriteUint64 ¶
* Write ASN.1 type: INTEGER. * Return count of written bytes.
func (*Asn1wr) WriteUint8 ¶
* Write ASN.1 type: INTEGER. * Return count of written bytes.
func (*Asn1wr) WriteUtf8Str ¶
* Write ASN.1 type: UTF8String. * Return count of written bytes.
func (*Asn1wr) WrittenLen ¶
* Returns how many bytes were already written to the ASN.1 structure.
type AuthDecrypt ¶
type AuthDecrypt interface { /* * Decrypt given data. * If 'tag' is not given, then it will be taken from the 'enc'. */ AuthDecrypt(data []byte, authData []byte, tag []byte) ([]byte, error) /* * Calculate required buffer length to hold the authenticated decrypted data. */ AuthDecryptedLen(dataLen uint) uint /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provide interface for data encryption.
func FoundationImplementationWrapAuthDecrypt ¶
func FoundationImplementationWrapAuthDecrypt(ctx *C.vscf_impl_t) (AuthDecrypt, error)
Wrap C implementation object to the Go object that implements interface AuthDecrypt.
type AuthEncrypt ¶
type AuthEncrypt interface { /* * Encrypt given data. * If 'tag' is not given, then it will written to the 'enc'. */ AuthEncrypt(data []byte, authData []byte) ([]byte, []byte, error) /* * Calculate required buffer length to hold the authenticated encrypted data. */ AuthEncryptedLen(dataLen uint) uint /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provide interface for authenticated data encryption.
func FoundationImplementationWrapAuthEncrypt ¶
func FoundationImplementationWrapAuthEncrypt(ctx *C.vscf_impl_t) (AuthEncrypt, error)
Wrap C implementation object to the Go object that implements interface AuthEncrypt.
type Base64 ¶
type Base64 struct { }
* Implementation of the Base64 algorithm RFC 1421 and RFC 2045.
type BrainkeyClient ¶
type BrainkeyClient struct {
// contains filtered or unexported fields
}
func NewBrainkeyClient ¶
func NewBrainkeyClient() *BrainkeyClient
func (*BrainkeyClient) Blind ¶
func (obj *BrainkeyClient) Blind(password []byte) ([]byte, []byte, error)
func (*BrainkeyClient) SetOperationRandom ¶
func (obj *BrainkeyClient) SetOperationRandom(operationRandom Random)
* Random used for crypto operations to make them const-time
func (*BrainkeyClient) SetRandom ¶
func (obj *BrainkeyClient) SetRandom(random Random)
* Random used for key generation, proofs, etc.
func (*BrainkeyClient) SetupDefaults ¶
func (obj *BrainkeyClient) SetupDefaults() error
type BrainkeyServer ¶
type BrainkeyServer struct {
// contains filtered or unexported fields
}
func NewBrainkeyServer ¶
func NewBrainkeyServer() *BrainkeyServer
func (*BrainkeyServer) GenerateIdentitySecret ¶
func (obj *BrainkeyServer) GenerateIdentitySecret() ([]byte, error)
func (*BrainkeyServer) Harden ¶
func (obj *BrainkeyServer) Harden(identitySecret []byte, blindedPoint []byte) ([]byte, error)
func (*BrainkeyServer) SetOperationRandom ¶
func (obj *BrainkeyServer) SetOperationRandom(operationRandom Random)
* Random used for crypto operations to make them const-time
func (*BrainkeyServer) SetRandom ¶
func (obj *BrainkeyServer) SetRandom(random Random)
* Random used for key generation, proofs, etc.
func (*BrainkeyServer) SetupDefaults ¶
func (obj *BrainkeyServer) SetupDefaults() error
type Cipher ¶
type Cipher interface { /* * Setup IV or nonce. */ SetNonce(nonce []byte) /* * Set cipher encryption / decryption key. */ SetKey(key []byte) /* * Start sequential encryption. */ StartEncryption() /* * Start sequential decryption. */ StartDecryption() /* * Process encryption or decryption of the given data chunk. */ Update(data []byte) []byte /* * Return buffer length required to hold an output of the methods * "update" or "finish" in an current mode. * Pass zero length to define buffer length of the method "finish". */ OutLen(dataLen uint) uint /* * Return buffer length required to hold an output of the methods * "update" or "finish" in an encryption mode. * Pass zero length to define buffer length of the method "finish". */ EncryptedOutLen(dataLen uint) uint /* * Return buffer length required to hold an output of the methods * "update" or "finish" in an decryption mode. * Pass zero length to define buffer length of the method "finish". */ DecryptedOutLen(dataLen uint) uint /* * Accomplish encryption or decryption process. */ Finish() ([]byte, error) /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provide interface for symmetric ciphers.
func AlgFactoryCreateCipherFromInfo ¶
* Create algorithm that implements "cipher" interface.
func FoundationImplementationWrapCipher ¶
func FoundationImplementationWrapCipher(ctx *C.vscf_impl_t) (Cipher, error)
Wrap C implementation object to the Go object that implements interface Cipher.
type CipherAlgInfo ¶
type CipherAlgInfo struct {
// contains filtered or unexported fields
}
* Handle symmetric cipher algorithm information.
func NewCipherAlgInfo ¶
func NewCipherAlgInfo() *CipherAlgInfo
func NewCipherAlgInfoWithMembers ¶
func NewCipherAlgInfoWithMembers(algId AlgId, nonce []byte) *CipherAlgInfo
* Create symmetric cipher algorithm info with identificator and input vector.
func (*CipherAlgInfo) AlgId ¶
func (obj *CipherAlgInfo) AlgId() AlgId
* Provide algorithm identificator.
type CipherAuth ¶
type CipherAuth interface { /* * Set additional data for for AEAD ciphers. */ SetAuthData(authData []byte) /* * Accomplish an authenticated encryption and place tag separately. * * Note, if authentication tag should be added to an encrypted data, * method "finish" can be used. */ FinishAuthEncryption() ([]byte, []byte, error) /* * Accomplish an authenticated decryption with explicitly given tag. * * Note, if authentication tag is a part of an encrypted data then, * method "finish" can be used for simplicity. */ FinishAuthDecryption(tag []byte) ([]byte, error) /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Mix-in interface that provides specific functionality to authenticated * encryption and decryption (AEAD ciphers).
func FoundationImplementationWrapCipherAuth ¶
func FoundationImplementationWrapCipherAuth(ctx *C.vscf_impl_t) (CipherAuth, error)
Wrap C implementation object to the Go object that implements interface CipherAuth.
type CipherAuthInfo ¶
type CipherAuthInfo interface { /* * Defines authentication tag length in bytes. */ GetAuthTagLen() uint /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
func FoundationImplementationWrapCipherAuthInfo ¶
func FoundationImplementationWrapCipherAuthInfo(ctx *C.vscf_impl_t) (CipherAuthInfo, error)
Wrap C implementation object to the Go object that implements interface CipherAuthInfo.
type CipherInfo ¶
type CipherInfo interface { /* * Cipher nfonce length or IV length in bytes, or 0 if nonce is not required. */ GetNonceLen() uint /* * Cipher key length in bytes. */ GetKeyLen() uint /* * Cipher key length in bits. */ GetKeyBitlen() uint /* * Cipher block length in bytes. */ GetBlockLen() uint /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provides compile time knownledge about algorithm.
func FoundationImplementationWrapCipherInfo ¶
func FoundationImplementationWrapCipherInfo(ctx *C.vscf_impl_t) (CipherInfo, error)
Wrap C implementation object to the Go object that implements interface CipherInfo.
type CipherState ¶
type CipherState int
* Enumerates possible sequentail cipher's states.
const ( /* * Cipher is ready for new encryption / decryption operation. */ CipherStateInitial CipherState = 0 /* * Cipher is configured for encryption. */ CipherStateEncryption CipherState = 1 /* * Cipher is configured for decryption. */ CipherStateDecryption CipherState = 2 )
type CompoundKeyAlg ¶
type CompoundKeyAlg struct {
// contains filtered or unexported fields
}
* Implements public key cryptography over compound keys. * * Compound key contains 2 keys - one for encryption/decryption and * one for signing/verifying.
func NewCompoundKeyAlg ¶
func NewCompoundKeyAlg() *CompoundKeyAlg
func (*CompoundKeyAlg) AlgId ¶
func (obj *CompoundKeyAlg) AlgId() AlgId
* Provide algorithm identificator.
func (*CompoundKeyAlg) CanDecrypt ¶
func (obj *CompoundKeyAlg) CanDecrypt(privateKey PrivateKey, dataLen uint) bool
* Check if algorithm can decrypt data with a given key. * However, success result of decryption is not guaranteed.
func (*CompoundKeyAlg) CanEncrypt ¶
func (obj *CompoundKeyAlg) CanEncrypt(publicKey PublicKey, dataLen uint) bool
* Check if algorithm can encrypt data with a given key.
func (*CompoundKeyAlg) CanSign ¶
func (obj *CompoundKeyAlg) CanSign(privateKey PrivateKey) bool
* Check if algorithm can sign data digest with a given key.
func (*CompoundKeyAlg) CanVerify ¶
func (obj *CompoundKeyAlg) CanVerify(publicKey PublicKey) bool
* Check if algorithm can verify data digest with a given key.
func (*CompoundKeyAlg) Decrypt ¶
func (obj *CompoundKeyAlg) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
* Decrypt given data.
func (*CompoundKeyAlg) DecryptedLen ¶
func (obj *CompoundKeyAlg) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
* Calculate required buffer length to hold the decrypted data.
func (*CompoundKeyAlg) Encrypt ¶
func (obj *CompoundKeyAlg) Encrypt(publicKey PublicKey, data []byte) ([]byte, error)
* Encrypt data with a given public key.
func (*CompoundKeyAlg) EncryptedLen ¶
func (obj *CompoundKeyAlg) EncryptedLen(publicKey PublicKey, dataLen uint) uint
* Calculate required buffer length to hold the encrypted data.
func (*CompoundKeyAlg) ExportPrivateKey ¶
func (obj *CompoundKeyAlg) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
* Export private key in the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA private key must be exported in format defined in * RFC 3447 Appendix A.1.2.
func (*CompoundKeyAlg) ExportPublicKey ¶
func (obj *CompoundKeyAlg) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
* Export public key to the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA public key must be exported in format defined in * RFC 3447 Appendix A.1.1.
func (*CompoundKeyAlg) GenerateEphemeralKey ¶
func (obj *CompoundKeyAlg) GenerateEphemeralKey(key Key) (PrivateKey, error)
* Generate ephemeral private key of the same type. * Note, this operation might be slow.
func (*CompoundKeyAlg) GetCanExportPrivateKey ¶
func (obj *CompoundKeyAlg) GetCanExportPrivateKey() bool
* Define whether a private key can be exported or not.
func (*CompoundKeyAlg) GetCanExportPublicKey ¶
func (obj *CompoundKeyAlg) GetCanExportPublicKey() bool
* Define whether a public key can be exported or not.
func (*CompoundKeyAlg) GetCanImportPrivateKey ¶
func (obj *CompoundKeyAlg) GetCanImportPrivateKey() bool
* Define whether a private key can be imported or not.
func (*CompoundKeyAlg) GetCanImportPublicKey ¶
func (obj *CompoundKeyAlg) GetCanImportPublicKey() bool
* Defines whether a public key can be imported or not.
func (*CompoundKeyAlg) ImportPrivateKey ¶
func (obj *CompoundKeyAlg) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
* Import private key from the raw binary format. * * Return private key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA private key must be imported from the format defined in * RFC 3447 Appendix A.1.2.
func (*CompoundKeyAlg) ImportPublicKey ¶
func (obj *CompoundKeyAlg) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
* Import public key from the raw binary format. * * Return public key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA public key must be imported from the format defined in * RFC 3447 Appendix A.1.1.
func (*CompoundKeyAlg) MakeKey ¶
func (obj *CompoundKeyAlg) MakeKey(cipherKey PrivateKey, signerKey PrivateKey) (PrivateKey, error)
* Make compound private key from given. * * Note, this operation might be slow.
func (*CompoundKeyAlg) ProduceAlgInfo ¶
func (obj *CompoundKeyAlg) ProduceAlgInfo() (AlgInfo, error)
* Produce object with algorithm information and configuration parameters.
func (*CompoundKeyAlg) RestoreAlgInfo ¶
func (obj *CompoundKeyAlg) RestoreAlgInfo(algInfo AlgInfo) error
* Restore algorithm configuration from the given object.
func (*CompoundKeyAlg) SetRandom ¶
func (obj *CompoundKeyAlg) SetRandom(random Random)
func (*CompoundKeyAlg) SetupDefaults ¶
func (obj *CompoundKeyAlg) SetupDefaults() error
* Setup predefined values to the uninitialized class dependencies.
func (*CompoundKeyAlg) SignHash ¶
func (obj *CompoundKeyAlg) SignHash(privateKey PrivateKey, hashId AlgId, digest []byte) ([]byte, error)
* Sign data digest with a given private key.
func (*CompoundKeyAlg) SignatureLen ¶
func (obj *CompoundKeyAlg) SignatureLen(privateKey PrivateKey) uint
* Return length in bytes required to hold signature. * Return zero if a given private key can not produce signatures.
func (*CompoundKeyAlg) VerifyHash ¶
func (obj *CompoundKeyAlg) VerifyHash(publicKey PublicKey, hashId AlgId, digest []byte, signature []byte) bool
* Verify data digest with a given public key and signature.
type CompoundKeyAlgInfo ¶
type CompoundKeyAlgInfo struct {
// contains filtered or unexported fields
}
* Handle information about compound key algorithm.
func NewCompoundKeyAlgInfo ¶
func NewCompoundKeyAlgInfo() *CompoundKeyAlgInfo
func (*CompoundKeyAlgInfo) AlgId ¶
func (obj *CompoundKeyAlgInfo) AlgId() AlgId
* Provide algorithm identificator.
func (*CompoundKeyAlgInfo) CipherAlgInfo ¶
func (obj *CompoundKeyAlgInfo) CipherAlgInfo() (AlgInfo, error)
* Return information about encrypt/decrypt algorithm.
func (*CompoundKeyAlgInfo) Ctx ¶
func (obj *CompoundKeyAlgInfo) Ctx() uintptr
Handle underlying C context.
func (*CompoundKeyAlgInfo) Delete ¶
func (obj *CompoundKeyAlgInfo) Delete()
* Release underlying C context.
func (*CompoundKeyAlgInfo) SignerAlgInfo ¶
func (obj *CompoundKeyAlgInfo) SignerAlgInfo() (AlgInfo, error)
* Return information about sign/verify algorithm.
type CompoundPrivateKey ¶
type CompoundPrivateKey struct {
// contains filtered or unexported fields
}
* Handles compound private key. * * Compound private key contains 2 private keys and signature: * - cipher key - is used for decryption; * - signer key - is used for signing.
func NewCompoundPrivateKey ¶
func NewCompoundPrivateKey() *CompoundPrivateKey
func (*CompoundPrivateKey) AlgId ¶
func (obj *CompoundPrivateKey) AlgId() AlgId
* Algorithm identifier the key belongs to.
func (*CompoundPrivateKey) AlgInfo ¶
func (obj *CompoundPrivateKey) AlgInfo() (AlgInfo, error)
* Return algorithm information that can be used for serialization.
func (*CompoundPrivateKey) Bitlen ¶
func (obj *CompoundPrivateKey) Bitlen() uint
* Length of the key in bits.
func (*CompoundPrivateKey) CipherKey ¶
func (obj *CompoundPrivateKey) CipherKey() (PrivateKey, error)
* Return primary private key suitable for a final decryption.
func (*CompoundPrivateKey) Ctx ¶
func (obj *CompoundPrivateKey) Ctx() uintptr
Handle underlying C context.
func (*CompoundPrivateKey) Delete ¶
func (obj *CompoundPrivateKey) Delete()
* Release underlying C context.
func (*CompoundPrivateKey) ExtractPublicKey ¶
func (obj *CompoundPrivateKey) ExtractPublicKey() (PublicKey, error)
* Extract public key from the private key.
func (*CompoundPrivateKey) IsValid ¶
func (obj *CompoundPrivateKey) IsValid() bool
* Check that key is valid. * Note, this operation can be slow.
func (*CompoundPrivateKey) Len ¶
func (obj *CompoundPrivateKey) Len() uint
* Length of the key in bytes.
func (*CompoundPrivateKey) SignerKey ¶
func (obj *CompoundPrivateKey) SignerKey() (PrivateKey, error)
* Return private key suitable for signing.
type CompoundPublicKey ¶
type CompoundPublicKey struct {
// contains filtered or unexported fields
}
* Handles compound public key. * * Compound public key contains 2 public keys and signature: * - cipher key - is used for encryption; * - signer key - is used for verifying.
func NewCompoundPublicKey ¶
func NewCompoundPublicKey() *CompoundPublicKey
func (*CompoundPublicKey) AlgId ¶
func (obj *CompoundPublicKey) AlgId() AlgId
* Algorithm identifier the key belongs to.
func (*CompoundPublicKey) AlgInfo ¶
func (obj *CompoundPublicKey) AlgInfo() (AlgInfo, error)
* Return algorithm information that can be used for serialization.
func (*CompoundPublicKey) Bitlen ¶
func (obj *CompoundPublicKey) Bitlen() uint
* Length of the key in bits.
func (*CompoundPublicKey) CipherKey ¶
func (obj *CompoundPublicKey) CipherKey() (PublicKey, error)
* Return a cipher public key suitable for initial encryption.
func (*CompoundPublicKey) Ctx ¶
func (obj *CompoundPublicKey) Ctx() uintptr
Handle underlying C context.
func (*CompoundPublicKey) Delete ¶
func (obj *CompoundPublicKey) Delete()
* Release underlying C context.
func (*CompoundPublicKey) IsValid ¶
func (obj *CompoundPublicKey) IsValid() bool
* Check that key is valid. * Note, this operation can be slow.
func (*CompoundPublicKey) Len ¶
func (obj *CompoundPublicKey) Len() uint
* Length of the key in bytes.
func (*CompoundPublicKey) SignerKey ¶
func (obj *CompoundPublicKey) SignerKey() (PublicKey, error)
* Return public key suitable for verifying.
type ComputeSharedKey ¶
type ComputeSharedKey interface { PublicKey, privateKey PrivateKey) ([]byte, error) SharedKeyLen(key Key) uint Delete() // contains filtered or unexported methods }ComputeSharedKey(publicKey
* Provide interface to compute shared key for 2 asymmetric keys.
func FoundationImplementationWrapComputeSharedKey ¶
func FoundationImplementationWrapComputeSharedKey(ctx *C.vscf_impl_t) (ComputeSharedKey, error)
Wrap C implementation object to the Go object that implements interface ComputeSharedKey.
type CtrDrbg ¶
type CtrDrbg struct {
// contains filtered or unexported fields
}
* Implementation of the RNG using deterministic random bit generators * based on block ciphers in counter mode (CTR_DRBG from NIST SP800-90A). * This class is thread-safe if the build option VSCF_MULTI_THREADING was enabled.
func NewCtrDrbg ¶
func NewCtrDrbg() *CtrDrbg
func (*CtrDrbg) EnablePredictionResistance ¶
func (obj *CtrDrbg) EnablePredictionResistance()
* Force entropy to be gathered at the beginning of every call to * the random() method. * Note, use this if your entropy source has sufficient throughput.
func (*CtrDrbg) SetEntropyLen ¶
* Sets the amount of entropy grabbed on each seed or reseed. * The default value is entropy len.
func (*CtrDrbg) SetEntropySource ¶
func (obj *CtrDrbg) SetEntropySource(entropySource EntropySource) error
func (*CtrDrbg) SetReseedInterval ¶
* Sets the reseed interval. * Default value is reseed interval.
func (*CtrDrbg) SetupDefaults ¶
* Setup predefined values to the uninitialized class dependencies.
type Curve25519 ¶
type Curve25519 struct {
// contains filtered or unexported fields
}
* This is implementation of Curve25519 elliptic curve algorithms.
func NewCurve25519 ¶
func NewCurve25519() *Curve25519
func (*Curve25519) CanDecrypt ¶
func (obj *Curve25519) CanDecrypt(privateKey PrivateKey, dataLen uint) bool
* Check if algorithm can decrypt data with a given key. * However, success result of decryption is not guaranteed.
func (*Curve25519) CanEncrypt ¶
func (obj *Curve25519) CanEncrypt(publicKey PublicKey, dataLen uint) bool
* Check if algorithm can encrypt data with a given key.
func (*Curve25519) ComputeSharedKey ¶
func (obj *Curve25519) ComputeSharedKey(publicKey PublicKey, privateKey PrivateKey) ([]byte, error)
* Compute shared key for 2 asymmetric keys. * Note, computed shared key can be used only within symmetric cryptography.
func (*Curve25519) Decrypt ¶
func (obj *Curve25519) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
* Decrypt given data.
func (*Curve25519) DecryptedLen ¶
func (obj *Curve25519) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
* Calculate required buffer length to hold the decrypted data.
func (*Curve25519) Encrypt ¶
func (obj *Curve25519) Encrypt(publicKey PublicKey, data []byte) ([]byte, error)
* Encrypt data with a given public key.
func (*Curve25519) EncryptedLen ¶
func (obj *Curve25519) EncryptedLen(publicKey PublicKey, dataLen uint) uint
* Calculate required buffer length to hold the encrypted data.
func (*Curve25519) ExportPrivateKey ¶
func (obj *Curve25519) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
* Export private key in the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA private key must be exported in format defined in * RFC 3447 Appendix A.1.2.
func (*Curve25519) ExportPublicKey ¶
func (obj *Curve25519) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
* Export public key to the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA public key must be exported in format defined in * RFC 3447 Appendix A.1.1.
func (*Curve25519) GenerateEphemeralKey ¶
func (obj *Curve25519) GenerateEphemeralKey(key Key) (PrivateKey, error)
* Generate ephemeral private key of the same type. * Note, this operation might be slow.
func (*Curve25519) GenerateKey ¶
func (obj *Curve25519) GenerateKey() (PrivateKey, error)
* Generate new private key. * Note, this operation might be slow.
func (*Curve25519) GetCanExportPrivateKey ¶
func (obj *Curve25519) GetCanExportPrivateKey() bool
* Define whether a private key can be exported or not.
func (*Curve25519) GetCanExportPublicKey ¶
func (obj *Curve25519) GetCanExportPublicKey() bool
* Define whether a public key can be exported or not.
func (*Curve25519) GetCanImportPrivateKey ¶
func (obj *Curve25519) GetCanImportPrivateKey() bool
* Define whether a private key can be imported or not.
func (*Curve25519) GetCanImportPublicKey ¶
func (obj *Curve25519) GetCanImportPublicKey() bool
* Defines whether a public key can be imported or not.
func (*Curve25519) ImportPrivateKey ¶
func (obj *Curve25519) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
* Import private key from the raw binary format. * * Return private key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA private key must be imported from the format defined in * RFC 3447 Appendix A.1.2.
func (*Curve25519) ImportPublicKey ¶
func (obj *Curve25519) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
* Import public key from the raw binary format. * * Return public key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA public key must be imported from the format defined in * RFC 3447 Appendix A.1.1.
func (*Curve25519) KemDecapsulate ¶
func (obj *Curve25519) KemDecapsulate(encapsulatedKey []byte, privateKey PrivateKey) ([]byte, error)
* Decapsulate the shared key.
func (*Curve25519) KemEncapsulate ¶
func (obj *Curve25519) KemEncapsulate(publicKey PublicKey) ([]byte, []byte, error)
* Generate a shared key and a key encapsulated message.
func (*Curve25519) KemEncapsulatedKeyLen ¶
func (obj *Curve25519) KemEncapsulatedKeyLen(publicKey PublicKey) uint
* Return length in bytes required to hold encapsulated key.
func (*Curve25519) KemSharedKeyLen ¶
func (obj *Curve25519) KemSharedKeyLen(key Key) uint
* Return length in bytes required to hold encapsulated shared key.
func (*Curve25519) SetEcies ¶
func (obj *Curve25519) SetEcies(ecies *Ecies)
func (*Curve25519) SetRandom ¶
func (obj *Curve25519) SetRandom(random Random)
func (*Curve25519) SetupDefaults ¶
func (obj *Curve25519) SetupDefaults() error
* Setup predefined values to the uninitialized class dependencies.
func (*Curve25519) SharedKeyLen ¶
func (obj *Curve25519) SharedKeyLen(key Key) uint
* Return number of bytes required to hold shared key. * Expect Public Key or Private Key.
type Decrypt ¶
type Decrypt interface { /* * Decrypt given data. */ Decrypt(data []byte) ([]byte, error) /* * Calculate required buffer length to hold the decrypted data. */ DecryptedLen(dataLen uint) uint /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provide interface for data encryption.
func FoundationImplementationWrapDecrypt ¶
func FoundationImplementationWrapDecrypt(ctx *C.vscf_impl_t) (Decrypt, error)
Wrap C implementation object to the Go object that implements interface Decrypt.
type Ecc ¶
type Ecc struct {
// contains filtered or unexported fields
}
* Elliptic curve cryptography implementation. * Supported curves: * - secp256r1.
func (*Ecc) CanDecrypt ¶
func (obj *Ecc) CanDecrypt(privateKey PrivateKey, dataLen uint) bool
* Check if algorithm can decrypt data with a given key. * However, success result of decryption is not guaranteed.
func (*Ecc) CanEncrypt ¶
* Check if algorithm can encrypt data with a given key.
func (*Ecc) CanSign ¶
func (obj *Ecc) CanSign(privateKey PrivateKey) bool
* Check if algorithm can sign data digest with a given key.
func (*Ecc) ComputeSharedKey ¶
func (obj *Ecc) ComputeSharedKey(publicKey PublicKey, privateKey PrivateKey) ([]byte, error)
* Compute shared key for 2 asymmetric keys. * Note, computed shared key can be used only within symmetric cryptography.
func (*Ecc) Decrypt ¶
func (obj *Ecc) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
* Decrypt given data.
func (*Ecc) DecryptedLen ¶
func (obj *Ecc) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
* Calculate required buffer length to hold the decrypted data.
func (*Ecc) EncryptedLen ¶
* Calculate required buffer length to hold the encrypted data.
func (*Ecc) ExportPrivateKey ¶
func (obj *Ecc) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
* Export private key in the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA private key must be exported in format defined in * RFC 3447 Appendix A.1.2.
func (*Ecc) ExportPublicKey ¶
func (obj *Ecc) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
* Export public key to the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA public key must be exported in format defined in * RFC 3447 Appendix A.1.1.
func (*Ecc) GenerateEphemeralKey ¶
func (obj *Ecc) GenerateEphemeralKey(key Key) (PrivateKey, error)
* Generate ephemeral private key of the same type. * Note, this operation might be slow.
func (*Ecc) GenerateKey ¶
func (obj *Ecc) GenerateKey(algId AlgId) (PrivateKey, error)
* Generate new private key. * Supported algorithm ids: * - secp256r1. * * Note, this operation might be slow.
func (*Ecc) GetCanExportPrivateKey ¶
* Define whether a private key can be exported or not.
func (*Ecc) GetCanExportPublicKey ¶
* Define whether a public key can be exported or not.
func (*Ecc) GetCanImportPrivateKey ¶
* Define whether a private key can be imported or not.
func (*Ecc) GetCanImportPublicKey ¶
* Defines whether a public key can be imported or not.
func (*Ecc) ImportPrivateKey ¶
func (obj *Ecc) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
* Import private key from the raw binary format. * * Return private key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA private key must be imported from the format defined in * RFC 3447 Appendix A.1.2.
func (*Ecc) ImportPublicKey ¶
func (obj *Ecc) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
* Import public key from the raw binary format. * * Return public key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA public key must be imported from the format defined in * RFC 3447 Appendix A.1.1.
func (*Ecc) KemDecapsulate ¶
func (obj *Ecc) KemDecapsulate(encapsulatedKey []byte, privateKey PrivateKey) ([]byte, error)
* Decapsulate the shared key.
func (*Ecc) KemEncapsulate ¶
* Generate a shared key and a key encapsulated message.
func (*Ecc) KemEncapsulatedKeyLen ¶
* Return length in bytes required to hold encapsulated key.
func (*Ecc) KemSharedKeyLen ¶
* Return length in bytes required to hold encapsulated shared key.
func (*Ecc) SetupDefaults ¶
* Setup predefined values to the uninitialized class dependencies.
func (*Ecc) SharedKeyLen ¶
* Return number of bytes required to hold shared key. * Expect Public Key or Private Key.
func (*Ecc) SignatureLen ¶
func (obj *Ecc) SignatureLen(privateKey PrivateKey) uint
* Return length in bytes required to hold signature. * Return zero if a given private key can not produce signatures.
type EccAlgInfo ¶
type EccAlgInfo struct {
// contains filtered or unexported fields
}
* Handle algorithm information about ECP.
func NewEccAlgInfo ¶
func NewEccAlgInfo() *EccAlgInfo
func NewEccAlgInfoWithMembers ¶
func NewEccAlgInfoWithMembers(algId AlgId, keyId OidId, domainId OidId) *EccAlgInfo
* Create algorithm info with EC generic key identificator, EC domain group identificator.
func (*EccAlgInfo) DomainId ¶
func (obj *EccAlgInfo) DomainId() OidId
* Return EC domain group identificator.
func (*EccAlgInfo) KeyId ¶
func (obj *EccAlgInfo) KeyId() OidId
* Return EC specific algorithm identificator {unrestricted, ecDH, ecMQV}.
type EccPrivateKey ¶
type EccPrivateKey struct {
// contains filtered or unexported fields
}
* Handles ECC private key.
func NewEccPrivateKey ¶
func NewEccPrivateKey() *EccPrivateKey
func (*EccPrivateKey) AlgId ¶
func (obj *EccPrivateKey) AlgId() AlgId
* Algorithm identifier the key belongs to.
func (*EccPrivateKey) AlgInfo ¶
func (obj *EccPrivateKey) AlgInfo() (AlgInfo, error)
* Return algorithm information that can be used for serialization.
func (*EccPrivateKey) ExtractPublicKey ¶
func (obj *EccPrivateKey) ExtractPublicKey() (PublicKey, error)
* Extract public key from the private key.
func (*EccPrivateKey) IsValid ¶
func (obj *EccPrivateKey) IsValid() bool
* Check that key is valid. * Note, this operation can be slow.
type EccPublicKey ¶
type EccPublicKey struct {
// contains filtered or unexported fields
}
* Handles ECC public key.
func NewEccPublicKey ¶
func NewEccPublicKey() *EccPublicKey
func (*EccPublicKey) AlgId ¶
func (obj *EccPublicKey) AlgId() AlgId
* Algorithm identifier the key belongs to.
func (*EccPublicKey) AlgInfo ¶
func (obj *EccPublicKey) AlgInfo() (AlgInfo, error)
* Return algorithm information that can be used for serialization.
func (*EccPublicKey) IsValid ¶
func (obj *EccPublicKey) IsValid() bool
* Check that key is valid. * Note, this operation can be slow.
type Ecies ¶
type Ecies struct {
// contains filtered or unexported fields
}
* Virgil implementation of the ECIES algorithm.
func (*Ecies) Decrypt ¶
func (obj *Ecies) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
* Decrypt given data.
func (*Ecies) DecryptedLen ¶
func (obj *Ecies) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
* Calculate required buffer length to hold the decrypted data.
func (*Ecies) EncryptedLen ¶
* Calculate required buffer length to hold the encrypted data.
func (*Ecies) ReleaseKeyAlg ¶
func (obj *Ecies) ReleaseKeyAlg()
* Release weak reference to the key algorithm.
func (*Ecies) SetEphemeralKey ¶
func (obj *Ecies) SetEphemeralKey(ephemeralKey PrivateKey)
* Set ephemeral key that used for data encryption. * Public and ephemeral keys should belong to the same curve. * This dependency is optional.
func (*Ecies) SetKeyAlg ¶
* Set weak reference to the key algorithm. * Key algorithm MUST support shared key computation as well.
func (*Ecies) SetupDefaults ¶
* Setup predefined values to the uninitialized class dependencies.
func (*Ecies) SetupDefaultsNoRandom ¶
func (obj *Ecies) SetupDefaultsNoRandom()
* Setup predefined values to the uninitialized class dependencies * except random.
type Ed25519 ¶
type Ed25519 struct {
// contains filtered or unexported fields
}
* This is implementation of Ed25519 elliptic curve algorithms.
func NewEd25519 ¶
func NewEd25519() *Ed25519
func (*Ed25519) CanDecrypt ¶
func (obj *Ed25519) CanDecrypt(privateKey PrivateKey, dataLen uint) bool
* Check if algorithm can decrypt data with a given key. * However, success result of decryption is not guaranteed.
func (*Ed25519) CanEncrypt ¶
* Check if algorithm can encrypt data with a given key.
func (*Ed25519) CanSign ¶
func (obj *Ed25519) CanSign(privateKey PrivateKey) bool
* Check if algorithm can sign data digest with a given key.
func (*Ed25519) ComputeSharedKey ¶
func (obj *Ed25519) ComputeSharedKey(publicKey PublicKey, privateKey PrivateKey) ([]byte, error)
* Compute shared key for 2 asymmetric keys. * Note, computed shared key can be used only within symmetric cryptography.
func (*Ed25519) Decrypt ¶
func (obj *Ed25519) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
* Decrypt given data.
func (*Ed25519) DecryptedLen ¶
func (obj *Ed25519) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
* Calculate required buffer length to hold the decrypted data.
func (*Ed25519) EncryptedLen ¶
* Calculate required buffer length to hold the encrypted data.
func (*Ed25519) ExportPrivateKey ¶
func (obj *Ed25519) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
* Export private key in the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA private key must be exported in format defined in * RFC 3447 Appendix A.1.2.
func (*Ed25519) ExportPublicKey ¶
func (obj *Ed25519) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
* Export public key to the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA public key must be exported in format defined in * RFC 3447 Appendix A.1.1.
func (*Ed25519) GenerateEphemeralKey ¶
func (obj *Ed25519) GenerateEphemeralKey(key Key) (PrivateKey, error)
* Generate ephemeral private key of the same type. * Note, this operation might be slow.
func (*Ed25519) GenerateKey ¶
func (obj *Ed25519) GenerateKey() (PrivateKey, error)
* Generate new private key. * Note, this operation might be slow.
func (*Ed25519) GetCanExportPrivateKey ¶
* Define whether a private key can be exported or not.
func (*Ed25519) GetCanExportPublicKey ¶
* Define whether a public key can be exported or not.
func (*Ed25519) GetCanImportPrivateKey ¶
* Define whether a private key can be imported or not.
func (*Ed25519) GetCanImportPublicKey ¶
* Defines whether a public key can be imported or not.
func (*Ed25519) ImportPrivateKey ¶
func (obj *Ed25519) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
* Import private key from the raw binary format. * * Return private key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA private key must be imported from the format defined in * RFC 3447 Appendix A.1.2.
func (*Ed25519) ImportPublicKey ¶
func (obj *Ed25519) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
* Import public key from the raw binary format. * * Return public key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA public key must be imported from the format defined in * RFC 3447 Appendix A.1.1.
func (*Ed25519) KemDecapsulate ¶
func (obj *Ed25519) KemDecapsulate(encapsulatedKey []byte, privateKey PrivateKey) ([]byte, error)
* Decapsulate the shared key.
func (*Ed25519) KemEncapsulate ¶
* Generate a shared key and a key encapsulated message.
func (*Ed25519) KemEncapsulatedKeyLen ¶
* Return length in bytes required to hold encapsulated key.
func (*Ed25519) KemSharedKeyLen ¶
* Return length in bytes required to hold encapsulated shared key.
func (*Ed25519) SetupDefaults ¶
* Setup predefined values to the uninitialized class dependencies.
func (*Ed25519) SharedKeyLen ¶
* Return number of bytes required to hold shared key. * Expect Public Key or Private Key.
func (*Ed25519) SignatureLen ¶
func (obj *Ed25519) SignatureLen(privateKey PrivateKey) uint
* Return length in bytes required to hold signature. * Return zero if a given private key can not produce signatures.
type Encrypt ¶
type Encrypt interface { /* * Encrypt given data. */ Encrypt(data []byte) ([]byte, error) /* * Calculate required buffer length to hold the encrypted data. */ EncryptedLen(dataLen uint) uint /* * Precise length calculation of encrypted data. */ PreciseEncryptedLen(dataLen uint) uint /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provide interface for data encryption.
func FoundationImplementationWrapEncrypt ¶
func FoundationImplementationWrapEncrypt(ctx *C.vscf_impl_t) (Encrypt, error)
Wrap C implementation object to the Go object that implements interface Encrypt.
type EntropyAccumulator ¶
type EntropyAccumulator struct {
// contains filtered or unexported fields
}
* Implementation based on a simple entropy accumulator.
func NewEntropyAccumulator ¶
func NewEntropyAccumulator() *EntropyAccumulator
func (*EntropyAccumulator) AddSource ¶
func (obj *EntropyAccumulator) AddSource(source EntropySource, threshold uint)
* Add given entropy source to the accumulator. * Threshold defines minimum number of bytes that must be gathered * from the source during accumulation.
func (*EntropyAccumulator) Ctx ¶
func (obj *EntropyAccumulator) Ctx() uintptr
Handle underlying C context.
func (*EntropyAccumulator) Delete ¶
func (obj *EntropyAccumulator) Delete()
* Release underlying C context.
func (*EntropyAccumulator) Gather ¶
func (obj *EntropyAccumulator) Gather(len uint) ([]byte, error)
* Gather entropy of the requested length.
func (*EntropyAccumulator) IsStrong ¶
func (obj *EntropyAccumulator) IsStrong() bool
* Defines that implemented source is strong.
func (*EntropyAccumulator) SetupDefaults ¶
func (obj *EntropyAccumulator) SetupDefaults()
* Setup predefined values to the uninitialized class dependencies.
type EntropySource ¶
type EntropySource interface { /* * Defines that implemented source is strong. */ IsStrong() bool /* * Gather entropy of the requested length. */ Gather(len uint) ([]byte, error) /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Defines generic interface for the entropy source.
func FoundationImplementationWrapEntropySource ¶
func FoundationImplementationWrapEntropySource(ctx *C.vscf_impl_t) (EntropySource, error)
Wrap C implementation object to the Go object that implements interface EntropySource.
type FakeRandom ¶
type FakeRandom struct {
// contains filtered or unexported fields
}
* Random number generator that is used for test purposes only.
func NewFakeRandom ¶
func NewFakeRandom() *FakeRandom
func (*FakeRandom) Gather ¶
func (obj *FakeRandom) Gather(len uint) ([]byte, error)
* Gather entropy of the requested length.
func (*FakeRandom) IsStrong ¶
func (obj *FakeRandom) IsStrong() bool
* Defines that implemented source is strong.
func (*FakeRandom) Random ¶
func (obj *FakeRandom) Random(dataLen uint) ([]byte, error)
* Generate random bytes. * All RNG implementations must be thread-safe.
func (*FakeRandom) Reseed ¶
func (obj *FakeRandom) Reseed() error
* Retrieve new seed data from the entropy sources.
func (*FakeRandom) SetupSourceByte ¶
func (obj *FakeRandom) SetupSourceByte(byteSource byte)
* Configure random number generator to generate sequence filled with given byte.
func (*FakeRandom) SetupSourceData ¶
func (obj *FakeRandom) SetupSourceData(dataSource []byte)
* Configure random number generator to generate random sequence from given data. * Note, that given data is used as circular source.
type Falcon ¶
type Falcon struct {
// contains filtered or unexported fields
}
* Provide post-quantum signature based on the falcon implementation. * For algorithm details check https://falcon-sign.info.
func (*Falcon) CanSign ¶
func (obj *Falcon) CanSign(privateKey PrivateKey) bool
* Check if algorithm can sign data digest with a given key.
func (*Falcon) ExportPrivateKey ¶
func (obj *Falcon) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
* Export private key in the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA private key must be exported in format defined in * RFC 3447 Appendix A.1.2.
func (*Falcon) ExportPublicKey ¶
func (obj *Falcon) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
* Export public key to the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA public key must be exported in format defined in * RFC 3447 Appendix A.1.1.
func (*Falcon) GenerateEphemeralKey ¶
func (obj *Falcon) GenerateEphemeralKey(key Key) (PrivateKey, error)
* Generate ephemeral private key of the same type. * Note, this operation might be slow.
func (*Falcon) GenerateKey ¶
func (obj *Falcon) GenerateKey() (PrivateKey, error)
* Generate new private key. * Note, this operation might be slow.
func (*Falcon) GetCanExportPrivateKey ¶
* Define whether a private key can be exported or not.
func (*Falcon) GetCanExportPublicKey ¶
* Define whether a public key can be exported or not.
func (*Falcon) GetCanImportPrivateKey ¶
* Define whether a private key can be imported or not.
func (*Falcon) GetCanImportPublicKey ¶
* Defines whether a public key can be imported or not.
func (*Falcon) ImportPrivateKey ¶
func (obj *Falcon) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
* Import private key from the raw binary format. * * Return private key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA private key must be imported from the format defined in * RFC 3447 Appendix A.1.2.
func (*Falcon) ImportPublicKey ¶
func (obj *Falcon) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
* Import public key from the raw binary format. * * Return public key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA public key must be imported from the format defined in * RFC 3447 Appendix A.1.1.
func (*Falcon) ProduceAlgInfo ¶
* Produce object with algorithm information and configuration parameters.
func (*Falcon) RestoreAlgInfo ¶
* Restore algorithm configuration from the given object.
func (*Falcon) SetupDefaults ¶
* Setup predefined values to the uninitialized class dependencies.
func (*Falcon) SignatureLen ¶
func (obj *Falcon) SignatureLen(privateKey PrivateKey) uint
* Return length in bytes required to hold signature. * Return zero if a given private key can not produce signatures.
type FooterInfo ¶
type FooterInfo struct {
// contains filtered or unexported fields
}
* Handle meta information about footer.
func NewFooterInfo ¶
func NewFooterInfo() *FooterInfo
func (*FooterInfo) HasSignedDataInfo ¶
func (obj *FooterInfo) HasSignedDataInfo() bool
* Retrun true if signed data info present.
func (*FooterInfo) SignedDataInfo ¶
func (obj *FooterInfo) SignedDataInfo() *SignedDataInfo
* Return signed data info.
type FoundationError ¶
* Defines the library status codes.
func (*FoundationError) Error ¶
func (obj *FoundationError) Error() string
type FoundationImplementation ¶
type FoundationImplementation struct { }
type GroupMsgType ¶
type GroupMsgType int
* Represents group message type
const ( /* * Group info type with encryption key. * This type of message should be encrypted before transferring. */ GroupMsgTypeGroupInfo GroupMsgType = 1 /* * Regular group message with encrypted text. */ GroupMsgTypeRegular GroupMsgType = 2 )
type GroupSession ¶
type GroupSession struct {
// contains filtered or unexported fields
}
* Group chat encryption session.
func NewGroupSession ¶
func NewGroupSession() *GroupSession
func (*GroupSession) AddEpoch ¶
func (obj *GroupSession) AddEpoch(message *GroupSessionMessage) error
* Adds epoch. New epoch should be generated for member removal or proactive to rotate encryption key. * Epoch message should be encrypted and signed by trusted group chat member (admin).
func (*GroupSession) CreateGroupTicket ¶
func (obj *GroupSession) CreateGroupTicket() (*GroupSessionTicket, error)
* Creates ticket with new key for removing participants or proactive to rotate encryption key.
func (*GroupSession) Decrypt ¶
func (obj *GroupSession) Decrypt(message *GroupSessionMessage, publicKey PublicKey) ([]byte, error)
* Decrypts message
func (*GroupSession) DecryptLen ¶
func (obj *GroupSession) DecryptLen(message *GroupSessionMessage) uint
* Calculates size of buffer sufficient to store decrypted message
func (*GroupSession) Encrypt ¶
func (obj *GroupSession) Encrypt(plainText []byte, privateKey PrivateKey) (*GroupSessionMessage, error)
* Encrypts data
func (*GroupSession) GetCurrentEpoch ¶
func (obj *GroupSession) GetCurrentEpoch() uint32
* Returns current epoch.
func (*GroupSession) GetSessionId ¶
func (obj *GroupSession) GetSessionId() []byte
* Returns session id.
func (*GroupSession) SetupDefaults ¶
func (obj *GroupSession) SetupDefaults() error
* Setups default dependencies: * - RNG: CTR DRBG
type GroupSessionMessage ¶
type GroupSessionMessage struct {
// contains filtered or unexported fields
}
* Class represents group session message
func GroupSessionMessageDeserialize ¶
func GroupSessionMessageDeserialize(input []byte) (*GroupSessionMessage, error)
* Deserializes instance.
func NewGroupSessionMessage ¶
func NewGroupSessionMessage() *GroupSessionMessage
func (*GroupSessionMessage) Ctx ¶
func (obj *GroupSessionMessage) Ctx() uintptr
Handle underlying C context.
func (*GroupSessionMessage) Delete ¶
func (obj *GroupSessionMessage) Delete()
* Release underlying C context.
func (*GroupSessionMessage) GetEpoch ¶
func (obj *GroupSessionMessage) GetEpoch() uint32
* Returns message epoch.
func (*GroupSessionMessage) GetSessionId ¶
func (obj *GroupSessionMessage) GetSessionId() []byte
* Returns session id. * This method should be called only for group info type.
func (*GroupSessionMessage) GetType ¶
func (obj *GroupSessionMessage) GetType() GroupMsgType
* Returns message type.
func (*GroupSessionMessage) Serialize ¶
func (obj *GroupSessionMessage) Serialize() []byte
* Serializes instance.
func (*GroupSessionMessage) SerializeLen ¶
func (obj *GroupSessionMessage) SerializeLen() uint
* Buffer len to serialize this class.
type GroupSessionTicket ¶
type GroupSessionTicket struct {
// contains filtered or unexported fields
}
* Group ticket used to start group session, remove participants or proactive to rotate encryption key.
func NewGroupSessionTicket ¶
func NewGroupSessionTicket() *GroupSessionTicket
func (*GroupSessionTicket) Ctx ¶
func (obj *GroupSessionTicket) Ctx() uintptr
Handle underlying C context.
func (*GroupSessionTicket) Delete ¶
func (obj *GroupSessionTicket) Delete()
* Release underlying C context.
func (*GroupSessionTicket) GetTicketMessage ¶
func (obj *GroupSessionTicket) GetTicketMessage() *GroupSessionMessage
* Returns message that should be sent to all participants using secure channel.
func (*GroupSessionTicket) SetRng ¶
func (obj *GroupSessionTicket) SetRng(rng Random)
* Random used to generate keys
func (*GroupSessionTicket) SetupDefaults ¶
func (obj *GroupSessionTicket) SetupDefaults() error
* Setups default dependencies: * - RNG: CTR DRBG
func (*GroupSessionTicket) SetupTicketAsNew ¶
func (obj *GroupSessionTicket) SetupTicketAsNew(sessionId []byte) error
* Set this ticket to start new group session.
type Hash ¶
type Hash interface { /* * Length of the digest (hashing output) in bytes. */ GetDigestLen() uint /* * Block length of the digest function in bytes. */ GetBlockLen() uint /* * Calculate hash over given data. */ Hash(data []byte) []byte /* * Start a new hashing. */ Start() /* * Add given data to the hash. */ Update(data []byte) /* * Accompilsh hashing and return it's result (a message digest). */ Finish() []byte /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provides interface to the hashing (messege digest) algorithms.
func AlgFactoryCreateHashFromInfo ¶
* Create algorithm that implements "hash stream" interface.
func FoundationImplementationWrapHash ¶
func FoundationImplementationWrapHash(ctx *C.vscf_impl_t) (Hash, error)
Wrap C implementation object to the Go object that implements interface Hash.
type HashBasedAlgInfo ¶
type HashBasedAlgInfo struct {
// contains filtered or unexported fields
}
* Handle hashed based algorithm information, i.e. HKDF, HMAC, etc.
func NewHashBasedAlgInfo ¶
func NewHashBasedAlgInfo() *HashBasedAlgInfo
func (*HashBasedAlgInfo) AlgId ¶
func (obj *HashBasedAlgInfo) AlgId() AlgId
* Provide algorithm identificator.
func (*HashBasedAlgInfo) Ctx ¶
func (obj *HashBasedAlgInfo) Ctx() uintptr
Handle underlying C context.
func (*HashBasedAlgInfo) Delete ¶
func (obj *HashBasedAlgInfo) Delete()
* Release underlying C context.
func (*HashBasedAlgInfo) HashAlgInfo ¶
func (obj *HashBasedAlgInfo) HashAlgInfo() (AlgInfo, error)
* Return hash algorithm information.
type Hkdf ¶
type Hkdf struct {
// contains filtered or unexported fields
}
* Virgil Security implementation of the HKDF (RFC 6234) algorithm.
func (*Hkdf) ProduceAlgInfo ¶
* Produce object with algorithm information and configuration parameters.
func (*Hkdf) RestoreAlgInfo ¶
* Restore algorithm configuration from the given object.
type Hmac ¶
type Hmac struct {
// contains filtered or unexported fields
}
* Virgil Security implementation of HMAC algorithm (RFC 2104) (FIPS PUB 198-1).
func (*Hmac) ProduceAlgInfo ¶
* Produce object with algorithm information and configuration parameters.
func (*Hmac) Reset ¶
func (obj *Hmac) Reset()
* Prepare to authenticate a new message with the same key * as the previous MAC operation.
func (*Hmac) RestoreAlgInfo ¶
* Restore algorithm configuration from the given object.
type HybridKeyAlg ¶
type HybridKeyAlg struct {
// contains filtered or unexported fields
}
* Implements public key cryptography over hybrid keys. * Hybrid encryption - TODO * Hybrid signatures - TODO
func NewHybridKeyAlg ¶
func NewHybridKeyAlg() *HybridKeyAlg
func (*HybridKeyAlg) CanDecrypt ¶
func (obj *HybridKeyAlg) CanDecrypt(privateKey PrivateKey, dataLen uint) bool
* Check if algorithm can decrypt data with a given key. * However, success result of decryption is not guaranteed.
func (*HybridKeyAlg) CanEncrypt ¶
func (obj *HybridKeyAlg) CanEncrypt(publicKey PublicKey, dataLen uint) bool
* Check if algorithm can encrypt data with a given key.
func (*HybridKeyAlg) CanSign ¶
func (obj *HybridKeyAlg) CanSign(privateKey PrivateKey) bool
* Check if algorithm can sign data digest with a given key.
func (*HybridKeyAlg) CanVerify ¶
func (obj *HybridKeyAlg) CanVerify(publicKey PublicKey) bool
* Check if algorithm can verify data digest with a given key.
func (*HybridKeyAlg) Decrypt ¶
func (obj *HybridKeyAlg) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
* Decrypt given data.
func (*HybridKeyAlg) DecryptedLen ¶
func (obj *HybridKeyAlg) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
* Calculate required buffer length to hold the decrypted data.
func (*HybridKeyAlg) Encrypt ¶
func (obj *HybridKeyAlg) Encrypt(publicKey PublicKey, data []byte) ([]byte, error)
* Encrypt data with a given public key.
func (*HybridKeyAlg) EncryptedLen ¶
func (obj *HybridKeyAlg) EncryptedLen(publicKey PublicKey, dataLen uint) uint
* Calculate required buffer length to hold the encrypted data.
func (*HybridKeyAlg) ExportPrivateKey ¶
func (obj *HybridKeyAlg) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
* Export private key in the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA private key must be exported in format defined in * RFC 3447 Appendix A.1.2.
func (*HybridKeyAlg) ExportPublicKey ¶
func (obj *HybridKeyAlg) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
* Export public key to the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA public key must be exported in format defined in * RFC 3447 Appendix A.1.1.
func (*HybridKeyAlg) GenerateEphemeralKey ¶
func (obj *HybridKeyAlg) GenerateEphemeralKey(key Key) (PrivateKey, error)
* Generate ephemeral private key of the same type. * Note, this operation might be slow.
func (*HybridKeyAlg) GetCanExportPrivateKey ¶
func (obj *HybridKeyAlg) GetCanExportPrivateKey() bool
* Define whether a private key can be exported or not.
func (*HybridKeyAlg) GetCanExportPublicKey ¶
func (obj *HybridKeyAlg) GetCanExportPublicKey() bool
* Define whether a public key can be exported or not.
func (*HybridKeyAlg) GetCanImportPrivateKey ¶
func (obj *HybridKeyAlg) GetCanImportPrivateKey() bool
* Define whether a private key can be imported or not.
func (*HybridKeyAlg) GetCanImportPublicKey ¶
func (obj *HybridKeyAlg) GetCanImportPublicKey() bool
* Defines whether a public key can be imported or not.
func (*HybridKeyAlg) ImportPrivateKey ¶
func (obj *HybridKeyAlg) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
* Import private key from the raw binary format. * * Return private key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA private key must be imported from the format defined in * RFC 3447 Appendix A.1.2.
func (*HybridKeyAlg) ImportPublicKey ¶
func (obj *HybridKeyAlg) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
* Import public key from the raw binary format. * * Return public key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA public key must be imported from the format defined in * RFC 3447 Appendix A.1.1.
func (*HybridKeyAlg) MakeKey ¶
func (obj *HybridKeyAlg) MakeKey(firstKey PrivateKey, secondKey PrivateKey) (PrivateKey, error)
* Make hybrid private key from given keys.
func (*HybridKeyAlg) SetCipher ¶
func (obj *HybridKeyAlg) SetCipher(cipher CipherAuth)
func (*HybridKeyAlg) SetHash ¶
func (obj *HybridKeyAlg) SetHash(hash Hash)
func (*HybridKeyAlg) SetRandom ¶
func (obj *HybridKeyAlg) SetRandom(random Random)
func (*HybridKeyAlg) SetupDefaults ¶
func (obj *HybridKeyAlg) SetupDefaults() error
* Setup predefined values to the uninitialized class dependencies.
func (*HybridKeyAlg) SignHash ¶
func (obj *HybridKeyAlg) SignHash(privateKey PrivateKey, hashId AlgId, digest []byte) ([]byte, error)
* Sign data digest with a given private key.
func (*HybridKeyAlg) SignatureLen ¶
func (obj *HybridKeyAlg) SignatureLen(privateKey PrivateKey) uint
* Return length in bytes required to hold signature. * Return zero if a given private key can not produce signatures.
func (*HybridKeyAlg) VerifyHash ¶
func (obj *HybridKeyAlg) VerifyHash(publicKey PublicKey, hashId AlgId, digest []byte, signature []byte) bool
* Verify data digest with a given public key and signature.
type HybridKeyAlgInfo ¶
type HybridKeyAlgInfo struct {
// contains filtered or unexported fields
}
* Handle information about hybrid key algorithm.
func NewHybridKeyAlgInfo ¶
func NewHybridKeyAlgInfo() *HybridKeyAlgInfo
func (*HybridKeyAlgInfo) AlgId ¶
func (obj *HybridKeyAlgInfo) AlgId() AlgId
* Provide algorithm identificator.
func (*HybridKeyAlgInfo) Ctx ¶
func (obj *HybridKeyAlgInfo) Ctx() uintptr
Handle underlying C context.
func (*HybridKeyAlgInfo) Delete ¶
func (obj *HybridKeyAlgInfo) Delete()
* Release underlying C context.
func (*HybridKeyAlgInfo) FirstKeyAlgInfo ¶
func (obj *HybridKeyAlgInfo) FirstKeyAlgInfo() (AlgInfo, error)
* Return algorithm information about the first key.
func (*HybridKeyAlgInfo) SecondKeyAlgInfo ¶
func (obj *HybridKeyAlgInfo) SecondKeyAlgInfo() (AlgInfo, error)
* Return algorithm information about the second key.
type HybridPrivateKey ¶
type HybridPrivateKey struct {
// contains filtered or unexported fields
}
* Handles a hybrid private key. * * The hybrid private key contains 2 private keys.
func NewHybridPrivateKey ¶
func NewHybridPrivateKey() *HybridPrivateKey
func (*HybridPrivateKey) AlgId ¶
func (obj *HybridPrivateKey) AlgId() AlgId
* Algorithm identifier the key belongs to.
func (*HybridPrivateKey) AlgInfo ¶
func (obj *HybridPrivateKey) AlgInfo() (AlgInfo, error)
* Return algorithm information that can be used for serialization.
func (*HybridPrivateKey) Bitlen ¶
func (obj *HybridPrivateKey) Bitlen() uint
* Length of the key in bits.
func (*HybridPrivateKey) Ctx ¶
func (obj *HybridPrivateKey) Ctx() uintptr
Handle underlying C context.
func (*HybridPrivateKey) Delete ¶
func (obj *HybridPrivateKey) Delete()
* Release underlying C context.
func (*HybridPrivateKey) ExtractPublicKey ¶
func (obj *HybridPrivateKey) ExtractPublicKey() (PublicKey, error)
* Extract public key from the private key.
func (*HybridPrivateKey) FirstKey ¶
func (obj *HybridPrivateKey) FirstKey() (PrivateKey, error)
* Return first private key.
func (*HybridPrivateKey) IsValid ¶
func (obj *HybridPrivateKey) IsValid() bool
* Check that key is valid. * Note, this operation can be slow.
func (*HybridPrivateKey) Len ¶
func (obj *HybridPrivateKey) Len() uint
* Length of the key in bytes.
func (*HybridPrivateKey) SecondKey ¶
func (obj *HybridPrivateKey) SecondKey() (PrivateKey, error)
* Return second private key.
type HybridPublicKey ¶
type HybridPublicKey struct {
// contains filtered or unexported fields
}
* Handles a hybrid public key. * * The hybrid public key contains 2 public keys.
func NewHybridPublicKey ¶
func NewHybridPublicKey() *HybridPublicKey
func (*HybridPublicKey) AlgId ¶
func (obj *HybridPublicKey) AlgId() AlgId
* Algorithm identifier the key belongs to.
func (*HybridPublicKey) AlgInfo ¶
func (obj *HybridPublicKey) AlgInfo() (AlgInfo, error)
* Return algorithm information that can be used for serialization.
func (*HybridPublicKey) Bitlen ¶
func (obj *HybridPublicKey) Bitlen() uint
* Length of the key in bits.
func (*HybridPublicKey) Ctx ¶
func (obj *HybridPublicKey) Ctx() uintptr
Handle underlying C context.
func (*HybridPublicKey) Delete ¶
func (obj *HybridPublicKey) Delete()
* Release underlying C context.
func (*HybridPublicKey) FirstKey ¶
func (obj *HybridPublicKey) FirstKey() (PublicKey, error)
* Return the first public key.
func (*HybridPublicKey) IsValid ¶
func (obj *HybridPublicKey) IsValid() bool
* Check that key is valid. * Note, this operation can be slow.
func (*HybridPublicKey) SecondKey ¶
func (obj *HybridPublicKey) SecondKey() (PublicKey, error)
* Return the second public key.
type Kdf ¶
type Kdf interface { /* * Derive key of the requested length from the given data. */ Derive(data []byte, keyLen uint) []byte /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provides interface to the key derivation function (KDF) algorithms.
func AlgFactoryCreateKdfFromInfo ¶
* Create algorithm that implements "kdf" interface.
func FoundationImplementationWrapKdf ¶
func FoundationImplementationWrapKdf(ctx *C.vscf_impl_t) (Kdf, error)
Wrap C implementation object to the Go object that implements interface Kdf.
type Kdf1 ¶
type Kdf1 struct {
// contains filtered or unexported fields
}
* Virgil Security implementation of the KDF1 (ISO-18033-2) algorithm.
func (*Kdf1) ProduceAlgInfo ¶
* Produce object with algorithm information and configuration parameters.
func (*Kdf1) RestoreAlgInfo ¶
* Restore algorithm configuration from the given object.
type Kdf2 ¶
type Kdf2 struct {
// contains filtered or unexported fields
}
* Virgil Security implementation of the KDF2 (ISO-18033-2) algorithm.
func (*Kdf2) ProduceAlgInfo ¶
* Produce object with algorithm information and configuration parameters.
func (*Kdf2) RestoreAlgInfo ¶
* Restore algorithm configuration from the given object.
type Kem ¶
type Kem interface { Key) uint /* * Return length in bytes required to hold encapsulated key. */ KemEncapsulatedKeyLen(publicKey PublicKey) uint /* * Generate a shared key and a key encapsulated message. */ KemEncapsulate(publicKey PublicKey) ([]byte, []byte, error) /* * Decapsulate the shared key. */ KemDecapsulate(encapsulatedKey []byte, privateKey PrivateKey) ([]byte, error) /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }KemSharedKeyLen(key
* Provides generic interface to the Key Encapsulation Mechanism (KEM).
func FoundationImplementationWrapKem ¶
func FoundationImplementationWrapKem(ctx *C.vscf_impl_t) (Kem, error)
Wrap C implementation object to the Go object that implements interface Kem.
type Key ¶
type Key interface { /* * Algorithm identifier the key belongs to. */ AlgId() AlgId /* * Return algorithm information that can be used for serialization. */ AlgInfo() (AlgInfo, error) /* * Length of the key in bytes. */ Len() uint /* * Length of the key in bits. */ Bitlen() uint /* * Check that key is valid. * Note, this operation can be slow. */ IsValid() bool /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Basic key type.
func FoundationImplementationWrapKey ¶
func FoundationImplementationWrapKey(ctx *C.vscf_impl_t) (Key, error)
Wrap C implementation object to the Go object that implements interface Key.
type KeyAlg ¶
type KeyAlg interface { /* * Defines whether a public key can be imported or not. */ GetCanImportPublicKey() bool /* * Define whether a public key can be exported or not. */ GetCanExportPublicKey() bool /* * Define whether a private key can be imported or not. */ GetCanImportPrivateKey() bool /* * Define whether a private key can be exported or not. */ GetCanExportPrivateKey() bool /* * Generate ephemeral private key of the same type. * Note, this operation might be slow. */ GenerateEphemeralKey(key Key) (PrivateKey, error) /* * Import public key from the raw binary format. * * Return public key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA public key must be imported from the format defined in * RFC 3447 Appendix A.1.1. */ ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error) /* * Export public key to the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA public key must be exported in format defined in * RFC 3447 Appendix A.1.1. */ ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error) /* * Import private key from the raw binary format. * * Return private key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA private key must be imported from the format defined in * RFC 3447 Appendix A.1.2. */ ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error) /* * Export private key in the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA private key must be exported in format defined in * RFC 3447 Appendix A.1.2. */ ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error) /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Common information about asymmetric key algorithm.
func FoundationImplementationWrapKeyAlg ¶
func FoundationImplementationWrapKeyAlg(ctx *C.vscf_impl_t) (KeyAlg, error)
Wrap C implementation object to the Go object that implements interface KeyAlg.
func KeyAlgFactoryCreateFromAlgId ¶
* Create a key algorithm based on an identifier.
func KeyAlgFactoryCreateFromKey ¶
* Create a key algorithm correspond to a specific key.
func KeyAlgFactoryCreateFromRawPrivateKey ¶
func KeyAlgFactoryCreateFromRawPrivateKey(privateKey *RawPrivateKey, random Random) (KeyAlg, error)
* Create a key algorithm that can import "raw private key".
func KeyAlgFactoryCreateFromRawPublicKey ¶
func KeyAlgFactoryCreateFromRawPublicKey(publicKey *RawPublicKey, random Random) (KeyAlg, error)
* Create a key algorithm that can import "raw public key".
type KeyAlgFactory ¶
type KeyAlgFactory struct { }
* Create a bridge between "raw keys" and algorithms that can import them.
type KeyAsn1Deserializer ¶
type KeyAsn1Deserializer struct {
// contains filtered or unexported fields
}
* Implements PKCS#8 and SEC1 key deserialization from DER / PEM format.
func NewKeyAsn1Deserializer ¶
func NewKeyAsn1Deserializer() *KeyAsn1Deserializer
func (*KeyAsn1Deserializer) Ctx ¶
func (obj *KeyAsn1Deserializer) Ctx() uintptr
Handle underlying C context.
func (*KeyAsn1Deserializer) Delete ¶
func (obj *KeyAsn1Deserializer) Delete()
* Release underlying C context.
func (*KeyAsn1Deserializer) DeserializePrivateKey ¶
func (obj *KeyAsn1Deserializer) DeserializePrivateKey(privateKeyData []byte) (*RawPrivateKey, error)
* Deserialize given private key as an interchangeable format to the object.
func (*KeyAsn1Deserializer) DeserializePrivateKeyInplace ¶
func (obj *KeyAsn1Deserializer) DeserializePrivateKeyInplace() (*RawPrivateKey, error)
* Deserialize Private Key by using internal ASN.1 reader. * Note, that caller code is responsible to reset ASN.1 reader with * an input buffer.
func (*KeyAsn1Deserializer) DeserializePublicKey ¶
func (obj *KeyAsn1Deserializer) DeserializePublicKey(publicKeyData []byte) (*RawPublicKey, error)
* Deserialize given public key as an interchangeable format to the object.
func (*KeyAsn1Deserializer) DeserializePublicKeyInplace ¶
func (obj *KeyAsn1Deserializer) DeserializePublicKeyInplace() (*RawPublicKey, error)
* Deserialize Public Key by using internal ASN.1 reader. * Note, that caller code is responsible to reset ASN.1 reader with * an input buffer.
func (*KeyAsn1Deserializer) SetAsn1Reader ¶
func (obj *KeyAsn1Deserializer) SetAsn1Reader(asn1Reader Asn1Reader)
func (*KeyAsn1Deserializer) SetupDefaults ¶
func (obj *KeyAsn1Deserializer) SetupDefaults()
* Setup predefined values to the uninitialized class dependencies.
type KeyAsn1Serializer ¶
type KeyAsn1Serializer struct {
// contains filtered or unexported fields
}
* Implements key serialization in the ASN.1 format (DER / PEM): * - SEC1 - for EC private keys; * - PKCS#8 - for other keys.
func NewKeyAsn1Serializer ¶
func NewKeyAsn1Serializer() *KeyAsn1Serializer
func (*KeyAsn1Serializer) Ctx ¶
func (obj *KeyAsn1Serializer) Ctx() uintptr
Handle underlying C context.
func (*KeyAsn1Serializer) Delete ¶
func (obj *KeyAsn1Serializer) Delete()
* Release underlying C context.
func (*KeyAsn1Serializer) SerializePrivateKey ¶
func (obj *KeyAsn1Serializer) SerializePrivateKey(privateKey *RawPrivateKey) ([]byte, error)
* Serialize given private key to an interchangeable format. * * Precondition: private key must be exportable.
func (*KeyAsn1Serializer) SerializePrivateKeyInplace ¶
func (obj *KeyAsn1Serializer) SerializePrivateKeyInplace(privateKey *RawPrivateKey) (uint, error)
* Serialize Private Key by using internal ASN.1 writer. * Note, that caller code is responsible to reset ASN.1 writer with * an output buffer.
func (*KeyAsn1Serializer) SerializePublicKey ¶
func (obj *KeyAsn1Serializer) SerializePublicKey(publicKey *RawPublicKey) ([]byte, error)
* Serialize given public key to an interchangeable format. * * Precondition: public key must be exportable.
func (*KeyAsn1Serializer) SerializePublicKeyInplace ¶
func (obj *KeyAsn1Serializer) SerializePublicKeyInplace(publicKey *RawPublicKey) (uint, error)
* Serialize Public Key by using internal ASN.1 writer. * Note, that caller code is responsible to reset ASN.1 writer with * an output buffer.
func (*KeyAsn1Serializer) SerializedPrivateKeyLen ¶
func (obj *KeyAsn1Serializer) SerializedPrivateKeyLen(privateKey *RawPrivateKey) uint
* Calculate buffer size enough to hold serialized private key. * * Precondition: private key must be exportable.
func (*KeyAsn1Serializer) SerializedPublicKeyLen ¶
func (obj *KeyAsn1Serializer) SerializedPublicKeyLen(publicKey *RawPublicKey) uint
* Calculate buffer size enough to hold serialized public key. * * Precondition: public key must be exportable.
func (*KeyAsn1Serializer) SetAsn1Writer ¶
func (obj *KeyAsn1Serializer) SetAsn1Writer(asn1Writer Asn1Writer)
func (*KeyAsn1Serializer) SetupDefaults ¶
func (obj *KeyAsn1Serializer) SetupDefaults()
* Setup predefined values to the uninitialized class dependencies.
type KeyCipher ¶
type KeyCipher interface { /* * Check if algorithm can encrypt data with a given key. */ CanEncrypt(publicKey PublicKey, dataLen uint) bool /* * Calculate required buffer length to hold the encrypted data. */ EncryptedLen(publicKey PublicKey, dataLen uint) uint /* * Encrypt data with a given public key. */ Encrypt(publicKey PublicKey, data []byte) ([]byte, error) /* * Check if algorithm can decrypt data with a given key. * However, success result of decryption is not guaranteed. */ CanDecrypt(privateKey PrivateKey, dataLen uint) bool /* * Calculate required buffer length to hold the decrypted data. */ DecryptedLen(privateKey PrivateKey, dataLen uint) uint /* * Decrypt given data. */ Decrypt(privateKey PrivateKey, data []byte) ([]byte, error) /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provide data encryption and decryption interface with asymmetric keys.
func FoundationImplementationWrapKeyCipher ¶
func FoundationImplementationWrapKeyCipher(ctx *C.vscf_impl_t) (KeyCipher, error)
Wrap C implementation object to the Go object that implements interface KeyCipher.
type KeyDeserializer ¶
type KeyDeserializer interface { /* * Deserialize given public key as an interchangeable format to the object. */ DeserializePublicKey(publicKeyData []byte) (*RawPublicKey, error) /* * Deserialize given private key as an interchangeable format to the object. */ DeserializePrivateKey(privateKeyData []byte) (*RawPrivateKey, error) /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Public and private key deserialization from an interchangeable format.
func FoundationImplementationWrapKeyDeserializer ¶
func FoundationImplementationWrapKeyDeserializer(ctx *C.vscf_impl_t) (KeyDeserializer, error)
Wrap C implementation object to the Go object that implements interface KeyDeserializer.
type KeyInfo ¶
type KeyInfo struct {
// contains filtered or unexported fields
}
func NewKeyInfo ¶
func NewKeyInfo() *KeyInfo
func NewKeyInfoWithAlgInfo ¶
* Build key information based on the generic algorithm information.
func (*KeyInfo) CompoundCipherAlgId ¶
* Return compound's cipher key id, if key is compound. * Return None, otherwise.
func (*KeyInfo) CompoundHybridCipherFirstKeyAlgId ¶
* Return hybrid's first key id of compound's cipher key, * if key is compound(hybrid, ...), None - otherwise.
func (*KeyInfo) CompoundHybridCipherSecondKeyAlgId ¶
* Return hybrid's second key id of compound's cipher key, * if key is compound(hybrid, ...), None - otherwise.
func (*KeyInfo) CompoundHybridSignerFirstKeyAlgId ¶
* Return hybrid's first key id of compound's signer key, * if key is compound(..., hybrid), None - otherwise.
func (*KeyInfo) CompoundHybridSignerSecondKeyAlgId ¶
* Return hybrid's second key id of compound's signer key, * if key is compound(..., hybrid), None - otherwise.
func (*KeyInfo) CompoundSignerAlgId ¶
* Return compound's signer key id, if key is compound. * Return None, otherwise.
func (*KeyInfo) HybridFirstKeyAlgId ¶
* Return hybrid's first key id, if key is hybrid. * Return None, otherwise.
func (*KeyInfo) HybridSecondKeyAlgId ¶
* Return hybrid's second key id, if key is hybrid. * Return None, otherwise.
func (*KeyInfo) IsCompound ¶
* Return true if a key is a compound key
func (*KeyInfo) IsCompoundHybrid ¶
* Return true if a key is a compound key and compounds cipher key * and signer key are hybrid keys.
func (*KeyInfo) IsCompoundHybridCipher ¶
* Return true if a key is a compound key and compounds cipher key * is a hybrid key.
func (*KeyInfo) IsCompoundHybridSigner ¶
* Return true if a key is a compound key and compounds signer key * is a hybrid key.
func (*KeyInfo) IsHybridPostQuantum ¶
* Return true if a key is a compound key that contains hybrid keys * for encryption/decryption and signing/verifying that itself * contains a combination of classic keys and post-quantum keys.
func (*KeyInfo) IsHybridPostQuantumCipher ¶
* Return true if a key is a compound key that contains a hybrid key * for encryption/decryption that contains a classic key and * a post-quantum key.
func (*KeyInfo) IsHybridPostQuantumSigner ¶
* Return true if a key is a compound key that contains a hybrid key * for signing/verifying that contains a classic key and * a post-quantum key.
type KeyMaterialRng ¶
type KeyMaterialRng struct {
// contains filtered or unexported fields
}
* Random number generator that generate deterministic sequence based * on a given seed. * This RNG can be used to transform key material rial to the private key.
func NewKeyMaterialRng ¶
func NewKeyMaterialRng() *KeyMaterialRng
func (*KeyMaterialRng) Random ¶
func (obj *KeyMaterialRng) Random(dataLen uint) ([]byte, error)
* Generate random bytes. * All RNG implementations must be thread-safe.
func (*KeyMaterialRng) Reseed ¶
func (obj *KeyMaterialRng) Reseed() error
* Retrieve new seed data from the entropy sources.
func (*KeyMaterialRng) ResetKeyMaterial ¶
func (obj *KeyMaterialRng) ResetKeyMaterial(keyMaterial []byte)
* Set a new key material.
type KeyProvider ¶
type KeyProvider struct {
// contains filtered or unexported fields
}
* Provide functionality for private key generation and importing that * relies on the software default implementations.
func NewKeyProvider ¶
func NewKeyProvider() *KeyProvider
func (*KeyProvider) ExportPrivateKey ¶
func (obj *KeyProvider) ExportPrivateKey(privateKey PrivateKey) ([]byte, error)
* Export given private key to the PKCS#8 or SEC1 DER format. * * Precondition: private key must be exportable.
func (*KeyProvider) ExportPublicKey ¶
func (obj *KeyProvider) ExportPublicKey(publicKey PublicKey) ([]byte, error)
* Export given public key to the PKCS#8 DER format. * * Precondition: public key must be exportable.
func (*KeyProvider) ExportedPrivateKeyLen ¶
func (obj *KeyProvider) ExportedPrivateKeyLen(privateKey PrivateKey) uint
* Calculate buffer size enough to hold exported private key. * * Precondition: private key must be exportable.
func (*KeyProvider) ExportedPublicKeyLen ¶
func (obj *KeyProvider) ExportedPublicKeyLen(publicKey PublicKey) uint
* Calculate buffer size enough to hold exported public key. * * Precondition: public key must be exportable.
func (*KeyProvider) GenerateCompoundHybridPrivateKey ¶
func (obj *KeyProvider) GenerateCompoundHybridPrivateKey(cipherFirstKeyAlgId AlgId, cipherSecondKeyAlgId AlgId, signerFirstKeyAlgId AlgId, signerSecondKeyAlgId AlgId) (PrivateKey, error)
* Generate new compound private key with nested hybrid private keys. * * Note, second key algorithm identifiers can be NONE, in this case, * a regular key will be crated instead of a hybrid key.
func (*KeyProvider) GenerateCompoundPrivateKey ¶
func (obj *KeyProvider) GenerateCompoundPrivateKey(cipherAlgId AlgId, signerAlgId AlgId) (PrivateKey, error)
* Generate new compound private key with given algorithms.
func (*KeyProvider) GenerateHybridPrivateKey ¶
func (obj *KeyProvider) GenerateHybridPrivateKey(firstKeyAlgId AlgId, secondKeyAlgId AlgId) (PrivateKey, error)
* Generate new hybrid private key with given algorithms.
func (*KeyProvider) GeneratePostQuantumPrivateKey ¶
func (obj *KeyProvider) GeneratePostQuantumPrivateKey() (PrivateKey, error)
* Generate new post-quantum private key with default algorithms. * Note, that a post-quantum key combines classic private keys * alongside with post-quantum private keys. * Current structure is "compound private key" is: * - cipher private key is "hybrid private key" where: * - first key is a classic private key; * - second key is a post-quantum private key; * - signer private key "hybrid private key" where: * - first key is a classic private key; * - second key is a post-quantum private key.
func (*KeyProvider) GeneratePrivateKey ¶
func (obj *KeyProvider) GeneratePrivateKey(algId AlgId) (PrivateKey, error)
* Generate new private key with a given algorithm.
func (*KeyProvider) ImportPrivateKey ¶
func (obj *KeyProvider) ImportPrivateKey(keyData []byte) (PrivateKey, error)
* Import private key from the PKCS#8 format.
func (*KeyProvider) ImportPublicKey ¶
func (obj *KeyProvider) ImportPublicKey(keyData []byte) (PublicKey, error)
* Import public key from the PKCS#8 format.
func (*KeyProvider) SetRandom ¶
func (obj *KeyProvider) SetRandom(random Random)
func (*KeyProvider) SetRsaParams ¶
func (obj *KeyProvider) SetRsaParams(bitlen uint)
* Setup parameters that is used during RSA key generation.
func (*KeyProvider) SetupDefaults ¶
func (obj *KeyProvider) SetupDefaults() error
* Setup predefined values to the uninitialized class dependencies.
type KeyRecipientInfo ¶
type KeyRecipientInfo struct {
// contains filtered or unexported fields
}
* Handle information about recipient that is defined by a Public Key.
func NewKeyRecipientInfo ¶
func NewKeyRecipientInfo() *KeyRecipientInfo
func NewKeyRecipientInfoWithData ¶
func NewKeyRecipientInfoWithData(recipientId []byte, keyEncryptionAlgorithm AlgInfo, encryptedKey []byte) *KeyRecipientInfo
* Create object and define all properties.
func (*KeyRecipientInfo) Ctx ¶
func (obj *KeyRecipientInfo) Ctx() uintptr
Handle underlying C context.
func (*KeyRecipientInfo) Delete ¶
func (obj *KeyRecipientInfo) Delete()
* Release underlying C context.
func (*KeyRecipientInfo) EncryptedKey ¶
func (obj *KeyRecipientInfo) EncryptedKey() []byte
* Return an encrypted data encryption key.
func (*KeyRecipientInfo) KeyEncryptionAlgorithm ¶
func (obj *KeyRecipientInfo) KeyEncryptionAlgorithm() (AlgInfo, error)
* Return algorithm information that was used for encryption * a data encryption key.
func (*KeyRecipientInfo) RecipientId ¶
func (obj *KeyRecipientInfo) RecipientId() []byte
* Return recipient identifier.
type KeyRecipientInfoList ¶
type KeyRecipientInfoList struct {
// contains filtered or unexported fields
}
* Handles a list of "key recipient info" class objects.
func NewKeyRecipientInfoList ¶
func NewKeyRecipientInfoList() *KeyRecipientInfoList
func (*KeyRecipientInfoList) Ctx ¶
func (obj *KeyRecipientInfoList) Ctx() uintptr
Handle underlying C context.
func (*KeyRecipientInfoList) Delete ¶
func (obj *KeyRecipientInfoList) Delete()
* Release underlying C context.
func (*KeyRecipientInfoList) HasItem ¶
func (obj *KeyRecipientInfoList) HasItem() bool
* Return true if given list has item.
func (*KeyRecipientInfoList) HasNext ¶
func (obj *KeyRecipientInfoList) HasNext() bool
* Return true if list has next item.
func (*KeyRecipientInfoList) HasPrev ¶
func (obj *KeyRecipientInfoList) HasPrev() bool
* Return true if list has previous item.
func (*KeyRecipientInfoList) Item ¶
func (obj *KeyRecipientInfoList) Item() *KeyRecipientInfo
* Return list item.
func (*KeyRecipientInfoList) Next ¶
func (obj *KeyRecipientInfoList) Next() *KeyRecipientInfoList
* Return next list node if exists, or NULL otherwise.
func (*KeyRecipientInfoList) Prev ¶
func (obj *KeyRecipientInfoList) Prev() *KeyRecipientInfoList
* Return previous list node if exists, or NULL otherwise.
type KeySerializer ¶
type KeySerializer interface { /* * Calculate buffer size enough to hold serialized public key. * * Precondition: public key must be exportable. */ SerializedPublicKeyLen(publicKey *RawPublicKey) uint /* * Serialize given public key to an interchangeable format. * * Precondition: public key must be exportable. */ SerializePublicKey(publicKey *RawPublicKey) ([]byte, error) /* * Calculate buffer size enough to hold serialized private key. * * Precondition: private key must be exportable. */ SerializedPrivateKeyLen(privateKey *RawPrivateKey) uint /* * Serialize given private key to an interchangeable format. * * Precondition: private key must be exportable. */ SerializePrivateKey(privateKey *RawPrivateKey) ([]byte, error) /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Public and private key serialization to an interchangeable format.
func FoundationImplementationWrapKeySerializer ¶
func FoundationImplementationWrapKeySerializer(ctx *C.vscf_impl_t) (KeySerializer, error)
Wrap C implementation object to the Go object that implements interface KeySerializer.
type KeySigner ¶
type KeySigner interface { /* * Check if algorithm can sign data digest with a given key. */ CanSign(privateKey PrivateKey) bool /* * Return length in bytes required to hold signature. * Return zero if a given private key can not produce signatures. */ SignatureLen(privateKey PrivateKey) uint /* * Sign data digest with a given private key. */ SignHash(privateKey PrivateKey, hashId AlgId, digest []byte) ([]byte, error) /* * Check if algorithm can verify data digest with a given key. */ CanVerify(publicKey PublicKey) bool /* * Verify data digest with a given public key and signature. */ VerifyHash(publicKey PublicKey, hashId AlgId, digest []byte, signature []byte) bool /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provide an interface for signing and verifying data digest * with asymmetric keys.
func FoundationImplementationWrapKeySigner ¶
func FoundationImplementationWrapKeySigner(ctx *C.vscf_impl_t) (KeySigner, error)
Wrap C implementation object to the Go object that implements interface KeySigner.
type Mac ¶
type Mac interface { /* * Size of the digest (mac output) in bytes. */ DigestLen() uint /* * Calculate MAC over given data. */ Mac(key []byte, data []byte) []byte /* * Start a new MAC. */ Start(key []byte) /* * Add given data to the MAC. */ Update(data []byte) /* * Accomplish MAC and return it's result (a message digest). */ Finish() []byte /* * Prepare to authenticate a new message with the same key * as the previous MAC operation. */ Reset() /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provides interface to the stateless MAC (message authentication code) algorithms.
func AlgFactoryCreateMacFromInfo ¶
* Create algorithm that implements "mac stream" interface.
func FoundationImplementationWrapMac ¶
func FoundationImplementationWrapMac(ctx *C.vscf_impl_t) (Mac, error)
Wrap C implementation object to the Go object that implements interface Mac.
type MessageInfo ¶
type MessageInfo struct {
// contains filtered or unexported fields
}
* Handle information about an encrypted message and algorithms * that was used for encryption.
func NewMessageInfo ¶
func NewMessageInfo() *MessageInfo
func (*MessageInfo) CipherKdfAlgInfo ¶
func (obj *MessageInfo) CipherKdfAlgInfo() (AlgInfo, error)
* Return cipher kdf alg info.
func (*MessageInfo) CipherPaddingAlgInfo ¶
func (obj *MessageInfo) CipherPaddingAlgInfo() (AlgInfo, error)
* Return cipher padding alg info.
func (*MessageInfo) CustomParams ¶
func (obj *MessageInfo) CustomParams() *MessageInfoCustomParams
* Provide access to the custom params object. * The returned object can be used to add custom params or read it. * If custom params object was not set then new empty object is created.
func (*MessageInfo) DataEncryptionAlgInfo ¶
func (obj *MessageInfo) DataEncryptionAlgInfo() (AlgInfo, error)
* Return information about algorithm that was used for the data encryption.
func (*MessageInfo) FooterInfo ¶
func (obj *MessageInfo) FooterInfo() *FooterInfo
* Return footer info.
func (*MessageInfo) HasCipherKdfAlgInfo ¶
func (obj *MessageInfo) HasCipherKdfAlgInfo() bool
* Return true if cipher kdf alg info exists.
func (*MessageInfo) HasCipherPaddingAlgInfo ¶
func (obj *MessageInfo) HasCipherPaddingAlgInfo() bool
* Return true if cipher padding alg info exists.
func (*MessageInfo) HasCustomParams ¶
func (obj *MessageInfo) HasCustomParams() bool
* Return true if message info contains at least one custom param.
func (*MessageInfo) HasFooterInfo ¶
func (obj *MessageInfo) HasFooterInfo() bool
* Return true if footer info exists.
func (*MessageInfo) KeyRecipientInfoList ¶
func (obj *MessageInfo) KeyRecipientInfoList() *KeyRecipientInfoList
* Return list with a "key recipient info" elements.
func (*MessageInfo) PasswordRecipientInfoList ¶
func (obj *MessageInfo) PasswordRecipientInfoList() *PasswordRecipientInfoList
* Return list with a "password recipient info" elements.
type MessageInfoCustomParams ¶
type MessageInfoCustomParams struct {
// contains filtered or unexported fields
}
func NewMessageInfoCustomParams ¶
func NewMessageInfoCustomParams() *MessageInfoCustomParams
func (*MessageInfoCustomParams) AddData ¶
func (obj *MessageInfoCustomParams) AddData(key []byte, value []byte)
* Add custom parameter with octet string value.
func (*MessageInfoCustomParams) AddInt ¶
func (obj *MessageInfoCustomParams) AddInt(key []byte, value int32)
* Add custom parameter with integer value.
func (*MessageInfoCustomParams) AddString ¶
func (obj *MessageInfoCustomParams) AddString(key []byte, value []byte)
* Add custom parameter with UTF8 string value.
func (*MessageInfoCustomParams) Clear ¶
func (obj *MessageInfoCustomParams) Clear()
* Remove all parameters.
func (*MessageInfoCustomParams) Ctx ¶
func (obj *MessageInfoCustomParams) Ctx() uintptr
Handle underlying C context.
func (*MessageInfoCustomParams) Delete ¶
func (obj *MessageInfoCustomParams) Delete()
* Release underlying C context.
func (*MessageInfoCustomParams) FindData ¶
func (obj *MessageInfoCustomParams) FindData(key []byte) ([]byte, error)
* Return custom parameter with octet string value.
func (*MessageInfoCustomParams) FindInt ¶
func (obj *MessageInfoCustomParams) FindInt(key []byte) (int32, error)
* Return custom parameter with integer value.
func (*MessageInfoCustomParams) FindString ¶
func (obj *MessageInfoCustomParams) FindString(key []byte) ([]byte, error)
* Return custom parameter with UTF8 string value.
func (*MessageInfoCustomParams) HasParams ¶
func (obj *MessageInfoCustomParams) HasParams() bool
* Return true if at least one param exists.
type MessageInfoDerSerializer ¶
type MessageInfoDerSerializer struct {
// contains filtered or unexported fields
}
* CMS based serialization of the class "message info".
func NewMessageInfoDerSerializer ¶
func NewMessageInfoDerSerializer() *MessageInfoDerSerializer
func (*MessageInfoDerSerializer) Ctx ¶
func (obj *MessageInfoDerSerializer) Ctx() uintptr
Handle underlying C context.
func (*MessageInfoDerSerializer) Delete ¶
func (obj *MessageInfoDerSerializer) Delete()
* Release underlying C context.
func (*MessageInfoDerSerializer) Deserialize ¶
func (obj *MessageInfoDerSerializer) Deserialize(data []byte) (*MessageInfo, error)
* Deserialize class "message info".
func (*MessageInfoDerSerializer) DeserializeFooter ¶
func (obj *MessageInfoDerSerializer) DeserializeFooter(data []byte) (*MessageInfoFooter, error)
* Deserialize class "message info footer".
func (*MessageInfoDerSerializer) GetPrefixLen ¶
func (obj *MessageInfoDerSerializer) GetPrefixLen() uint
func (*MessageInfoDerSerializer) ReadPrefix ¶
func (obj *MessageInfoDerSerializer) ReadPrefix(data []byte) uint
* Read message info prefix from the given data, and if it is valid, * return a length of bytes of the whole message info. * * Zero returned if length can not be determined from the given data, * and this means that there is no message info at the data beginning.
func (*MessageInfoDerSerializer) Serialize ¶
func (obj *MessageInfoDerSerializer) Serialize(messageInfo *MessageInfo) []byte
* Serialize class "message info".
func (*MessageInfoDerSerializer) SerializeFooter ¶
func (obj *MessageInfoDerSerializer) SerializeFooter(messageInfoFooter *MessageInfoFooter) []byte
* Serialize class "message info footer".
func (*MessageInfoDerSerializer) SerializedFooterLen ¶
func (obj *MessageInfoDerSerializer) SerializedFooterLen(messageInfoFooter *MessageInfoFooter) uint
* Return buffer size enough to hold serialized message info footer.
func (*MessageInfoDerSerializer) SerializedLen ¶
func (obj *MessageInfoDerSerializer) SerializedLen(messageInfo *MessageInfo) uint
* Return buffer size enough to hold serialized message info.
func (*MessageInfoDerSerializer) SetAsn1Reader ¶
func (obj *MessageInfoDerSerializer) SetAsn1Reader(asn1Reader Asn1Reader)
func (*MessageInfoDerSerializer) SetAsn1Writer ¶
func (obj *MessageInfoDerSerializer) SetAsn1Writer(asn1Writer Asn1Writer)
func (*MessageInfoDerSerializer) SetupDefaults ¶
func (obj *MessageInfoDerSerializer) SetupDefaults()
* Setup predefined values to the uninitialized class dependencies.
type MessageInfoEditor ¶
type MessageInfoEditor struct {
// contains filtered or unexported fields
}
* Add and/or remove recipients and it's parameters within message info. * * Usage: * 1. Unpack binary message info that was obtained from RecipientCipher. * 2. Add and/or remove key recipients. * 3. Pack MessagInfo to the binary data.
func NewMessageInfoEditor ¶
func NewMessageInfoEditor() *MessageInfoEditor
func (*MessageInfoEditor) AddKeyRecipient ¶
func (obj *MessageInfoEditor) AddKeyRecipient(recipientId []byte, publicKey PublicKey) error
* Add recipient defined with id and public key.
func (*MessageInfoEditor) Ctx ¶
func (obj *MessageInfoEditor) Ctx() uintptr
Handle underlying C context.
func (*MessageInfoEditor) Delete ¶
func (obj *MessageInfoEditor) Delete()
* Release underlying C context.
func (*MessageInfoEditor) Pack ¶
func (obj *MessageInfoEditor) Pack() []byte
* Return serialized message info. * Precondition: this method can be called after "apply".
func (*MessageInfoEditor) PackedLen ¶
func (obj *MessageInfoEditor) PackedLen() uint
* Return length of serialized message info. * Actual length can be obtained right after applying changes.
func (*MessageInfoEditor) RemoveAll ¶
func (obj *MessageInfoEditor) RemoveAll()
* Remove all existent recipients.
func (*MessageInfoEditor) RemoveKeyRecipient ¶
func (obj *MessageInfoEditor) RemoveKeyRecipient(recipientId []byte) bool
* Remove recipient with a given id. * Return false if recipient with given id was not found.
func (*MessageInfoEditor) SetRandom ¶
func (obj *MessageInfoEditor) SetRandom(random Random)
func (*MessageInfoEditor) SetupDefaults ¶
func (obj *MessageInfoEditor) SetupDefaults() error
* Set dependencies to it's defaults.
func (*MessageInfoEditor) Unlock ¶
func (obj *MessageInfoEditor) Unlock(ownerRecipientId []byte, ownerPrivateKey PrivateKey) error
* Decrypt encryption key this allows adding new recipients.
func (*MessageInfoEditor) Unpack ¶
func (obj *MessageInfoEditor) Unpack(messageInfoData []byte) error
* Unpack serialized message info. * * Note that recipients can only be removed but not added. * Note, use "unlock" method to be able to add new recipients as well.
type MessageInfoFooter ¶
type MessageInfoFooter struct {
// contains filtered or unexported fields
}
* Handle message signatures and related information.
func NewMessageInfoFooter ¶
func NewMessageInfoFooter() *MessageInfoFooter
func (*MessageInfoFooter) Ctx ¶
func (obj *MessageInfoFooter) Ctx() uintptr
Handle underlying C context.
func (*MessageInfoFooter) Delete ¶
func (obj *MessageInfoFooter) Delete()
* Release underlying C context.
func (*MessageInfoFooter) HasSignerInfos ¶
func (obj *MessageInfoFooter) HasSignerInfos() bool
* Return true if at least one signer info presents.
func (*MessageInfoFooter) SignerDigest ¶
func (obj *MessageInfoFooter) SignerDigest() []byte
* Return plain text digest that was used to produce signature.
func (*MessageInfoFooter) SignerHashAlgInfo ¶
func (obj *MessageInfoFooter) SignerHashAlgInfo() (AlgInfo, error)
* Return information about algorithm that was used for data hashing.
func (*MessageInfoFooter) SignerInfos ¶
func (obj *MessageInfoFooter) SignerInfos() *SignerInfoList
* Return list with a "signer info" elements.
type MessageInfoFooterSerializer ¶
type MessageInfoFooterSerializer interface { MessageInfoFooter) uint SerializeFooter(messageInfoFooter *MessageInfoFooter) []byte DeserializeFooter(data []byte) (*MessageInfoFooter, error) Delete() // contains filtered or unexported methods }SerializedFooterLen(messageInfoFooter *
* Provide interface for "message info footer" class serialization.
func FoundationImplementationWrapMessageInfoFooterSerializer ¶
func FoundationImplementationWrapMessageInfoFooterSerializer(ctx *C.vscf_impl_t) (MessageInfoFooterSerializer, error)
Wrap C implementation object to the Go object that implements interface MessageInfoFooterSerializer.
type MessageInfoSerializer ¶
type MessageInfoSerializer interface { GetPrefixLen() uint /* * Return buffer size enough to hold serialized message info. */ SerializedLen(messageInfo *MessageInfo) uint /* * Serialize class "message info". */ Serialize(messageInfo *MessageInfo) []byte /* * Read message info prefix from the given data, and if it is valid, * return a length of bytes of the whole message info. * * Zero returned if length can not be determined from the given data, * and this means that there is no message info at the data beginning. */ ReadPrefix(data []byte) uint /* * Deserialize class "message info". */ Deserialize(data []byte) (*MessageInfo, error) /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provide interface for "message info" class serialization.
func FoundationImplementationWrapMessageInfoSerializer ¶
func FoundationImplementationWrapMessageInfoSerializer(ctx *C.vscf_impl_t) (MessageInfoSerializer, error)
Wrap C implementation object to the Go object that implements interface MessageInfoSerializer.
type OidId ¶
type OidId int
const ( OidIdNone OidId = 0 OidIdRsa OidId = 1 OidIdEd25519 OidId = 2 OidIdCurve25519 OidId = 3 OidIdSha224 OidId = 4 OidIdSha256 OidId = 5 OidIdSha384 OidId = 6 OidIdSha512 OidId = 7 OidIdKdf1 OidId = 8 OidIdKdf2 OidId = 9 OidIdAes256Gcm OidId = 10 OidIdAes256Cbc OidId = 11 OidIdPkcs5Pbkdf2 OidId = 12 OidIdPkcs5Pbes2 OidId = 13 OidIdCmsData OidId = 14 OidIdCmsEnvelopedData OidId = 15 OidIdHkdfWithSha256 OidId = 16 OidIdHkdfWithSha384 OidId = 17 OidIdHkdfWithSha512 OidId = 18 OidIdHmacWithSha224 OidId = 19 OidIdHmacWithSha256 OidId = 20 OidIdHmacWithSha384 OidId = 21 OidIdHmacWithSha512 OidId = 22 OidIdEcGenericKey OidId = 23 OidIdEcDomainSecp256r1 OidId = 24 OidIdCompoundKey OidId = 25 OidIdHybridKey OidId = 26 OidIdFalcon OidId = 27 OidIdRound5Nd5kem5d OidId = 28 OidIdRandomPadding OidId = 29 )
type Padding ¶
type Padding interface { /* * Set new padding parameters. */ Configure(params *PaddingParams) /* * Return length in bytes of a data with a padding. */ PaddedDataLen(dataLen uint) uint /* * Return an actual number of padding in bytes. * Note, this method might be called right before "finish data processing". */ Len() uint /* * Return a maximum number of padding in bytes. */ LenMax() uint /* * Prepare the algorithm to process data. */ StartDataProcessing() /* * Only data length is needed to produce padding later. * Return data that should be further proceeded. */ ProcessData(data []byte) []byte /* * Accomplish data processing and return padding. */ FinishDataProcessing() ([]byte, error) /* * Prepare the algorithm to process padded data. */ StartPaddedDataProcessing() /* * Process padded data. * Return filtered data without padding. */ ProcessPaddedData(data []byte) []byte /* * Return length in bytes required hold output of the method * "finish padded data processing". */ FinishPaddedDataProcessingOutLen() uint /* * Accomplish padded data processing and return left data without a padding. */ FinishPaddedDataProcessing() ([]byte, error) /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provide an interface to add and remove data padding.
func AlgFactoryCreatePaddingFromInfo ¶
* Create algorithm that implements "padding" interface.
func FoundationImplementationWrapPadding ¶
func FoundationImplementationWrapPadding(ctx *C.vscf_impl_t) (Padding, error)
Wrap C implementation object to the Go object that implements interface Padding.
type PaddingParams ¶
type PaddingParams struct {
// contains filtered or unexported fields
}
* Handles padding parameters and constraints.
func NewPaddingParams ¶
func NewPaddingParams() *PaddingParams
func NewPaddingParamsWithConstraints ¶
func NewPaddingParamsWithConstraints(frame uint, frameMax uint) *PaddingParams
* Build padding params with given constraints. * Next formula can clarify what frame is: padding_length = data_length MOD frame
func (*PaddingParams) Frame ¶
func (obj *PaddingParams) Frame() uint
* Return padding frame in bytes.
func (*PaddingParams) FrameMax ¶
func (obj *PaddingParams) FrameMax() uint
* Return maximum padding frame in bytes.
type PasswordRecipientInfo ¶
type PasswordRecipientInfo struct {
// contains filtered or unexported fields
}
* Handle information about recipient that is defined by a password.
func NewPasswordRecipientInfo ¶
func NewPasswordRecipientInfo() *PasswordRecipientInfo
func NewPasswordRecipientInfoWithMembers ¶
func NewPasswordRecipientInfoWithMembers(keyEncryptionAlgorithm AlgInfo, encryptedKey []byte) *PasswordRecipientInfo
* Create object and define all properties.
func (*PasswordRecipientInfo) Ctx ¶
func (obj *PasswordRecipientInfo) Ctx() uintptr
Handle underlying C context.
func (*PasswordRecipientInfo) Delete ¶
func (obj *PasswordRecipientInfo) Delete()
* Release underlying C context.
func (*PasswordRecipientInfo) EncryptedKey ¶
func (obj *PasswordRecipientInfo) EncryptedKey() []byte
* Return an encrypted data encryption key.
func (*PasswordRecipientInfo) KeyEncryptionAlgorithm ¶
func (obj *PasswordRecipientInfo) KeyEncryptionAlgorithm() (AlgInfo, error)
* Return algorithm information that was used for encryption * a data encryption key.
type PasswordRecipientInfoList ¶
type PasswordRecipientInfoList struct {
// contains filtered or unexported fields
}
* Handles a list of "password recipient info" class objects.
func NewPasswordRecipientInfoList ¶
func NewPasswordRecipientInfoList() *PasswordRecipientInfoList
func (*PasswordRecipientInfoList) Clear ¶
func (obj *PasswordRecipientInfoList) Clear()
* Remove all items.
func (*PasswordRecipientInfoList) Ctx ¶
func (obj *PasswordRecipientInfoList) Ctx() uintptr
Handle underlying C context.
func (*PasswordRecipientInfoList) Delete ¶
func (obj *PasswordRecipientInfoList) Delete()
* Release underlying C context.
func (*PasswordRecipientInfoList) HasItem ¶
func (obj *PasswordRecipientInfoList) HasItem() bool
* Return true if given list has item.
func (*PasswordRecipientInfoList) HasNext ¶
func (obj *PasswordRecipientInfoList) HasNext() bool
* Return true if list has next item.
func (*PasswordRecipientInfoList) HasPrev ¶
func (obj *PasswordRecipientInfoList) HasPrev() bool
* Return true if list has previous item.
func (*PasswordRecipientInfoList) Item ¶
func (obj *PasswordRecipientInfoList) Item() *PasswordRecipientInfo
* Return list item.
func (*PasswordRecipientInfoList) Next ¶
func (obj *PasswordRecipientInfoList) Next() *PasswordRecipientInfoList
* Return next list node if exists, or NULL otherwise.
func (*PasswordRecipientInfoList) Prev ¶
func (obj *PasswordRecipientInfoList) Prev() *PasswordRecipientInfoList
* Return previous list node if exists, or NULL otherwise.
type PbeAlgInfo ¶
type PbeAlgInfo struct {
// contains filtered or unexported fields
}
* Handle information about password-based encryption algorithm.
func NewPbeAlgInfo ¶
func NewPbeAlgInfo() *PbeAlgInfo
func (*PbeAlgInfo) CipherAlgInfo ¶
func (obj *PbeAlgInfo) CipherAlgInfo() (AlgInfo, error)
* Return cipher algorithm information.
func (*PbeAlgInfo) KdfAlgInfo ¶
func (obj *PbeAlgInfo) KdfAlgInfo() (AlgInfo, error)
* Return KDF algorithm information.
type Pkcs5Pbes2 ¶
type Pkcs5Pbes2 struct {
// contains filtered or unexported fields
}
* Virgil Security implementation of the PBES2 (RFC 8018) algorithm.
func NewPkcs5Pbes2 ¶
func NewPkcs5Pbes2() *Pkcs5Pbes2
func (*Pkcs5Pbes2) Decrypt ¶
func (obj *Pkcs5Pbes2) Decrypt(data []byte) ([]byte, error)
* Decrypt given data.
func (*Pkcs5Pbes2) DecryptedLen ¶
func (obj *Pkcs5Pbes2) DecryptedLen(dataLen uint) uint
* Calculate required buffer length to hold the decrypted data.
func (*Pkcs5Pbes2) Encrypt ¶
func (obj *Pkcs5Pbes2) Encrypt(data []byte) ([]byte, error)
* Encrypt given data.
func (*Pkcs5Pbes2) EncryptedLen ¶
func (obj *Pkcs5Pbes2) EncryptedLen(dataLen uint) uint
* Calculate required buffer length to hold the encrypted data.
func (*Pkcs5Pbes2) PreciseEncryptedLen ¶
func (obj *Pkcs5Pbes2) PreciseEncryptedLen(dataLen uint) uint
* Precise length calculation of encrypted data.
func (*Pkcs5Pbes2) ProduceAlgInfo ¶
func (obj *Pkcs5Pbes2) ProduceAlgInfo() (AlgInfo, error)
* Produce object with algorithm information and configuration parameters.
func (*Pkcs5Pbes2) Reset ¶
func (obj *Pkcs5Pbes2) Reset(pwd []byte)
* Configure cipher with a new password.
func (*Pkcs5Pbes2) RestoreAlgInfo ¶
func (obj *Pkcs5Pbes2) RestoreAlgInfo(algInfo AlgInfo) error
* Restore algorithm configuration from the given object.
func (*Pkcs5Pbes2) SetCipher ¶
func (obj *Pkcs5Pbes2) SetCipher(cipher Cipher)
func (*Pkcs5Pbes2) SetKdf ¶
func (obj *Pkcs5Pbes2) SetKdf(kdf SaltedKdf)
type Pkcs5Pbkdf2 ¶
type Pkcs5Pbkdf2 struct {
// contains filtered or unexported fields
}
* Virgil Security implementation of the PBKDF2 (RFC 8018) algorithm.
func NewPkcs5Pbkdf2 ¶
func NewPkcs5Pbkdf2() *Pkcs5Pbkdf2
func (*Pkcs5Pbkdf2) AlgId ¶
func (obj *Pkcs5Pbkdf2) AlgId() AlgId
* Provide algorithm identificator.
func (*Pkcs5Pbkdf2) Derive ¶
func (obj *Pkcs5Pbkdf2) Derive(data []byte, keyLen uint) []byte
* Derive key of the requested length from the given data.
func (*Pkcs5Pbkdf2) ProduceAlgInfo ¶
func (obj *Pkcs5Pbkdf2) ProduceAlgInfo() (AlgInfo, error)
* Produce object with algorithm information and configuration parameters.
func (*Pkcs5Pbkdf2) Reset ¶
func (obj *Pkcs5Pbkdf2) Reset(salt []byte, iterationCount uint)
* Prepare algorithm to derive new key.
func (*Pkcs5Pbkdf2) RestoreAlgInfo ¶
func (obj *Pkcs5Pbkdf2) RestoreAlgInfo(algInfo AlgInfo) error
* Restore algorithm configuration from the given object.
func (*Pkcs5Pbkdf2) SetHmac ¶
func (obj *Pkcs5Pbkdf2) SetHmac(hmac Mac)
func (*Pkcs5Pbkdf2) SetInfo ¶
func (obj *Pkcs5Pbkdf2) SetInfo(info []byte)
* Setup application specific information (optional). * Can be empty.
func (*Pkcs5Pbkdf2) SetupDefaults ¶
func (obj *Pkcs5Pbkdf2) SetupDefaults()
* Setup predefined values to the uninitialized class dependencies.
type Pkcs8Serializer ¶
type Pkcs8Serializer struct {
// contains filtered or unexported fields
}
* Implements PKCS#8 key serialization to DER format.
func NewPkcs8Serializer ¶
func NewPkcs8Serializer() *Pkcs8Serializer
func (*Pkcs8Serializer) Ctx ¶
func (obj *Pkcs8Serializer) Ctx() uintptr
Handle underlying C context.
func (*Pkcs8Serializer) Delete ¶
func (obj *Pkcs8Serializer) Delete()
* Release underlying C context.
func (*Pkcs8Serializer) SerializePrivateKey ¶
func (obj *Pkcs8Serializer) SerializePrivateKey(privateKey *RawPrivateKey) ([]byte, error)
* Serialize given private key to an interchangeable format. * * Precondition: private key must be exportable.
func (*Pkcs8Serializer) SerializePrivateKeyInplace ¶
func (obj *Pkcs8Serializer) SerializePrivateKeyInplace(privateKey *RawPrivateKey) (uint, error)
* Serialize Private Key by using internal ASN.1 writer. * Note, that caller code is responsible to reset ASN.1 writer with * an output buffer.
func (*Pkcs8Serializer) SerializePublicKey ¶
func (obj *Pkcs8Serializer) SerializePublicKey(publicKey *RawPublicKey) ([]byte, error)
* Serialize given public key to an interchangeable format. * * Precondition: public key must be exportable.
func (*Pkcs8Serializer) SerializePublicKeyInplace ¶
func (obj *Pkcs8Serializer) SerializePublicKeyInplace(publicKey *RawPublicKey) (uint, error)
* Serialize Public Key by using internal ASN.1 writer. * Note, that caller code is responsible to reset ASN.1 writer with * an output buffer.
func (*Pkcs8Serializer) SerializedPrivateKeyLen ¶
func (obj *Pkcs8Serializer) SerializedPrivateKeyLen(privateKey *RawPrivateKey) uint
* Calculate buffer size enough to hold serialized private key. * * Precondition: private key must be exportable.
func (*Pkcs8Serializer) SerializedPublicKeyLen ¶
func (obj *Pkcs8Serializer) SerializedPublicKeyLen(publicKey *RawPublicKey) uint
* Calculate buffer size enough to hold serialized public key. * * Precondition: public key must be exportable.
func (*Pkcs8Serializer) SetAsn1Writer ¶
func (obj *Pkcs8Serializer) SetAsn1Writer(asn1Writer Asn1Writer)
func (*Pkcs8Serializer) SetupDefaults ¶
func (obj *Pkcs8Serializer) SetupDefaults()
* Setup predefined values to the uninitialized class dependencies.
type PrivateKey ¶
type PrivateKey interface { /* * Extract public key from the private key. */ ExtractPublicKey() (PublicKey, error) /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Contains private part of the key.
func FoundationImplementationWrapPrivateKey ¶
func FoundationImplementationWrapPrivateKey(ctx *C.vscf_impl_t) (PrivateKey, error)
Wrap C implementation object to the Go object that implements interface PrivateKey.
type PublicKey ¶
type PublicKey interface { /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Contains public part of the key.
func FoundationImplementationWrapPublicKey ¶
func FoundationImplementationWrapPublicKey(ctx *C.vscf_impl_t) (PublicKey, error)
Wrap C implementation object to the Go object that implements interface PublicKey.
type Random ¶
type Random interface { /* * Generate random bytes. * All RNG implementations must be thread-safe. */ Random(dataLen uint) ([]byte, error) /* * Retrieve new seed data from the entropy sources. */ Reseed() error /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Common interface to get random data.
func FoundationImplementationWrapRandom ¶
func FoundationImplementationWrapRandom(ctx *C.vscf_impl_t) (Random, error)
Wrap C implementation object to the Go object that implements interface Random.
type RandomPadding ¶
type RandomPadding struct {
// contains filtered or unexported fields
}
* Append a random number of padding bytes to a data.
func NewRandomPadding ¶
func NewRandomPadding() *RandomPadding
func (*RandomPadding) AlgId ¶
func (obj *RandomPadding) AlgId() AlgId
* Provide algorithm identificator.
func (*RandomPadding) Configure ¶
func (obj *RandomPadding) Configure(params *PaddingParams)
* Set new padding parameters.
func (*RandomPadding) FinishDataProcessing ¶
func (obj *RandomPadding) FinishDataProcessing() ([]byte, error)
* Accomplish data processing and return padding.
func (*RandomPadding) FinishPaddedDataProcessing ¶
func (obj *RandomPadding) FinishPaddedDataProcessing() ([]byte, error)
* Accomplish padded data processing and return left data without a padding.
func (*RandomPadding) FinishPaddedDataProcessingOutLen ¶
func (obj *RandomPadding) FinishPaddedDataProcessingOutLen() uint
* Return length in bytes required hold output of the method * "finish padded data processing".
func (*RandomPadding) Len ¶
func (obj *RandomPadding) Len() uint
* Return an actual number of padding in bytes. * Note, this method might be called right before "finish data processing".
func (*RandomPadding) LenMax ¶
func (obj *RandomPadding) LenMax() uint
* Return a maximum number of padding in bytes.
func (*RandomPadding) PaddedDataLen ¶
func (obj *RandomPadding) PaddedDataLen(dataLen uint) uint
* Return length in bytes of a data with a padding.
func (*RandomPadding) ProcessData ¶
func (obj *RandomPadding) ProcessData(data []byte) []byte
* Only data length is needed to produce padding later. * Return data that should be further proceeded.
func (*RandomPadding) ProcessPaddedData ¶
func (obj *RandomPadding) ProcessPaddedData(data []byte) []byte
* Process padded data. * Return filtered data without padding.
func (*RandomPadding) ProduceAlgInfo ¶
func (obj *RandomPadding) ProduceAlgInfo() (AlgInfo, error)
* Produce object with algorithm information and configuration parameters.
func (*RandomPadding) RestoreAlgInfo ¶
func (obj *RandomPadding) RestoreAlgInfo(algInfo AlgInfo) error
* Restore algorithm configuration from the given object.
func (*RandomPadding) SetRandom ¶
func (obj *RandomPadding) SetRandom(random Random)
func (*RandomPadding) StartDataProcessing ¶
func (obj *RandomPadding) StartDataProcessing()
* Prepare the algorithm to process data.
func (*RandomPadding) StartPaddedDataProcessing ¶
func (obj *RandomPadding) StartPaddedDataProcessing()
* Prepare the algorithm to process padded data.
type RawPrivateKey ¶
type RawPrivateKey struct {
// contains filtered or unexported fields
}
* Handles interchangeable private key representation.
func NewRawPrivateKey ¶
func NewRawPrivateKey() *RawPrivateKey
func (*RawPrivateKey) AlgId ¶
func (obj *RawPrivateKey) AlgId() AlgId
* Algorithm identifier the key belongs to.
func (*RawPrivateKey) AlgInfo ¶
func (obj *RawPrivateKey) AlgInfo() (AlgInfo, error)
* Return algorithm information that can be used for serialization.
func (*RawPrivateKey) ExtractPublicKey ¶
func (obj *RawPrivateKey) ExtractPublicKey() (PublicKey, error)
* Extract public key from the private key.
func (*RawPrivateKey) GetPublicKey ¶
func (obj *RawPrivateKey) GetPublicKey() *RawPublicKey
* Return public key related to the private key.
func (*RawPrivateKey) HasPublicKey ¶
func (obj *RawPrivateKey) HasPublicKey() bool
* Return true if private key contains public key.
func (*RawPrivateKey) IsValid ¶
func (obj *RawPrivateKey) IsValid() bool
* Check that key is valid. * Note, this operation can be slow.
func (*RawPrivateKey) SetPublicKey ¶
func (obj *RawPrivateKey) SetPublicKey(rawPublicKey *RawPublicKey)
* Setup public key related to the private key.
type RawPublicKey ¶
type RawPublicKey struct {
// contains filtered or unexported fields
}
* Handles interchangeable public key representation.
func NewRawPublicKey ¶
func NewRawPublicKey() *RawPublicKey
func (*RawPublicKey) AlgId ¶
func (obj *RawPublicKey) AlgId() AlgId
* Algorithm identifier the key belongs to.
func (*RawPublicKey) AlgInfo ¶
func (obj *RawPublicKey) AlgInfo() (AlgInfo, error)
* Return algorithm information that can be used for serialization.
func (*RawPublicKey) IsValid ¶
func (obj *RawPublicKey) IsValid() bool
* Check that key is valid. * Note, this operation can be slow.
type RecipientCipher ¶
type RecipientCipher struct {
// contains filtered or unexported fields
}
* This class provides hybrid encryption algorithm that combines symmetric * cipher for data encryption and asymmetric cipher and password based * cipher for symmetric key encryption.
func NewRecipientCipher ¶
func NewRecipientCipher() *RecipientCipher
func (*RecipientCipher) AddKeyRecipient ¶
func (obj *RecipientCipher) AddKeyRecipient(recipientId []byte, publicKey PublicKey)
* Add recipient defined with id and public key.
func (*RecipientCipher) AddSigner ¶
func (obj *RecipientCipher) AddSigner(signerId []byte, privateKey PrivateKey) error
* Add identifier and private key to sign initial plain text. * Return error if the private key can not sign.
func (*RecipientCipher) ClearRecipients ¶
func (obj *RecipientCipher) ClearRecipients()
* Remove all recipients.
func (*RecipientCipher) ClearSigners ¶
func (obj *RecipientCipher) ClearSigners()
* Remove all signers.
func (*RecipientCipher) Ctx ¶
func (obj *RecipientCipher) Ctx() uintptr
Handle underlying C context.
func (*RecipientCipher) CustomParams ¶
func (obj *RecipientCipher) CustomParams() *MessageInfoCustomParams
* Provide access to the custom params object. * The returned object can be used to add custom params or read it.
func (*RecipientCipher) DecryptionOutLen ¶
func (obj *RecipientCipher) DecryptionOutLen(dataLen uint) uint
* Return buffer length required to hold output of the method * "process decryption" and method "finish" during decryption.
func (*RecipientCipher) Delete ¶
func (obj *RecipientCipher) Delete()
* Release underlying C context.
func (*RecipientCipher) EncryptionOutLen ¶
func (obj *RecipientCipher) EncryptionOutLen(dataLen uint) uint
* Return buffer length required to hold output of the method * "process encryption" and method "finish" during encryption.
func (*RecipientCipher) FinishDecryption ¶
func (obj *RecipientCipher) FinishDecryption() ([]byte, error)
* Accomplish decryption.
func (*RecipientCipher) FinishEncryption ¶
func (obj *RecipientCipher) FinishEncryption() ([]byte, error)
* Accomplish encryption.
func (*RecipientCipher) HasKeyRecipient ¶
func (obj *RecipientCipher) HasKeyRecipient(recipientId []byte) bool
* Return true if a key recipient with a given id has been added. * Note, operation has O(N) time complexity.
func (*RecipientCipher) IsDataSigned ¶
func (obj *RecipientCipher) IsDataSigned() bool
* Return true if data was signed by a sender. * * Precondition: this method should be called after "finish decryption".
func (*RecipientCipher) MessageInfoFooterLen ¶
func (obj *RecipientCipher) MessageInfoFooterLen() uint
* Return buffer length required to hold message footer returned by the * "pack message footer" method. * * Precondition: this method should be called after "finish encryption".
func (*RecipientCipher) MessageInfoLen ¶
func (obj *RecipientCipher) MessageInfoLen() uint
* Return buffer length required to hold message info returned by the * "pack message info" method. * Precondition: all recipients and custom parameters should be set.
func (*RecipientCipher) PackMessageInfo ¶
func (obj *RecipientCipher) PackMessageInfo() []byte
* Return serialized message info to the buffer. * * Precondition: this method should be called after "start encryption". * Precondition: this method should be called before "finish encryption". * * Note, store message info to use it for decryption process, * or place it at the encrypted data beginning (embedding). * * Return message info - recipients public information, * algorithm information, etc.
func (*RecipientCipher) PackMessageInfoFooter ¶
func (obj *RecipientCipher) PackMessageInfoFooter() ([]byte, error)
* Return serialized message info footer to the buffer. * * Precondition: this method should be called after "finish encryption". * * Note, store message info to use it for verified decryption process, * or place it at the encrypted data ending (embedding). * * Return message info footer - signers public information, etc.
func (*RecipientCipher) ProcessDecryption ¶
func (obj *RecipientCipher) ProcessDecryption(data []byte) ([]byte, error)
* Process with a new portion of data. * Return error if data can not be encrypted or decrypted.
func (*RecipientCipher) ProcessEncryption ¶
func (obj *RecipientCipher) ProcessEncryption(data []byte) ([]byte, error)
* Process encryption of a new portion of data.
func (*RecipientCipher) SetEncryptionCipher ¶
func (obj *RecipientCipher) SetEncryptionCipher(encryptionCipher Cipher)
func (*RecipientCipher) SetEncryptionPadding ¶
func (obj *RecipientCipher) SetEncryptionPadding(encryptionPadding Padding)
func (*RecipientCipher) SetPaddingParams ¶
func (obj *RecipientCipher) SetPaddingParams(paddingParams *PaddingParams)
func (*RecipientCipher) SetRandom ¶
func (obj *RecipientCipher) SetRandom(random Random)
func (*RecipientCipher) SetSignerHash ¶
func (obj *RecipientCipher) SetSignerHash(signerHash Hash)
func (*RecipientCipher) SignerInfos ¶
func (obj *RecipientCipher) SignerInfos() *SignerInfoList
* Return information about signers that sign data. * * Precondition: this method should be called after "finish decryption". * Precondition: method "is data signed" returns true.
func (*RecipientCipher) StartDecryptionWithKey ¶
func (obj *RecipientCipher) StartDecryptionWithKey(recipientId []byte, privateKey PrivateKey, messageInfo []byte) error
* Initiate decryption process with a recipient private key. * Message Info can be empty if it was embedded to encrypted data.
func (*RecipientCipher) StartEncryption ¶
func (obj *RecipientCipher) StartEncryption() error
* Start encryption process.
func (*RecipientCipher) StartSignedEncryption ¶
func (obj *RecipientCipher) StartSignedEncryption(dataSize uint) error
* Start encryption process with known plain text size. * * Precondition: At least one signer should be added. * Note, store message info footer as well.
func (*RecipientCipher) StartVerifiedDecryptionWithKey ¶
func (obj *RecipientCipher) StartVerifiedDecryptionWithKey(recipientId []byte, privateKey PrivateKey, messageInfo []byte, messageInfoFooter []byte) error
* Initiate decryption process with a recipient private key. * Message Info can be empty if it was embedded to encrypted data. * Message Info footer can be empty if it was embedded to encrypted data. * If footer was embedded, method "start decryption with key" can be used.
func (*RecipientCipher) VerifySignerInfo ¶
func (obj *RecipientCipher) VerifySignerInfo(signerInfo *SignerInfo, publicKey PublicKey) bool
* Verify given cipher info.
type Round5 ¶
type Round5 struct {
// contains filtered or unexported fields
}
* Provide post-quantum encryption based on the round5 implementation. * For algorithm details check https://github.com/round5/code
func (*Round5) ExportPrivateKey ¶
func (obj *Round5) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
* Export private key in the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA private key must be exported in format defined in * RFC 3447 Appendix A.1.2.
func (*Round5) ExportPublicKey ¶
func (obj *Round5) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
* Export public key to the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA public key must be exported in format defined in * RFC 3447 Appendix A.1.1.
func (*Round5) GenerateEphemeralKey ¶
func (obj *Round5) GenerateEphemeralKey(key Key) (PrivateKey, error)
* Generate ephemeral private key of the same type. * Note, this operation might be slow.
func (*Round5) GenerateKey ¶
func (obj *Round5) GenerateKey(algId AlgId) (PrivateKey, error)
* Generate new private key. * Note, this operation might be slow.
func (*Round5) GetCanExportPrivateKey ¶
* Define whether a private key can be exported or not.
func (*Round5) GetCanExportPublicKey ¶
* Define whether a public key can be exported or not.
func (*Round5) GetCanImportPrivateKey ¶
* Define whether a private key can be imported or not.
func (*Round5) GetCanImportPublicKey ¶
* Defines whether a public key can be imported or not.
func (*Round5) ImportPrivateKey ¶
func (obj *Round5) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
* Import private key from the raw binary format. * * Return private key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA private key must be imported from the format defined in * RFC 3447 Appendix A.1.2.
func (*Round5) ImportPublicKey ¶
func (obj *Round5) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
* Import public key from the raw binary format. * * Return public key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA public key must be imported from the format defined in * RFC 3447 Appendix A.1.1.
func (*Round5) KemDecapsulate ¶
func (obj *Round5) KemDecapsulate(encapsulatedKey []byte, privateKey PrivateKey) ([]byte, error)
* Decapsulate the shared key.
func (*Round5) KemEncapsulate ¶
* Generate a shared key and a key encapsulated message.
func (*Round5) KemEncapsulatedKeyLen ¶
* Return length in bytes required to hold encapsulated key.
func (*Round5) KemSharedKeyLen ¶
* Return length in bytes required to hold encapsulated shared key.
func (*Round5) SetupDefaults ¶
* Setup predefined values to the uninitialized class dependencies.
type Rsa ¶
type Rsa struct {
// contains filtered or unexported fields
}
* RSA implementation.
func (*Rsa) CanDecrypt ¶
func (obj *Rsa) CanDecrypt(privateKey PrivateKey, dataLen uint) bool
* Check if algorithm can decrypt data with a given key. * However, success result of decryption is not guaranteed.
func (*Rsa) CanEncrypt ¶
* Check if algorithm can encrypt data with a given key.
func (*Rsa) CanSign ¶
func (obj *Rsa) CanSign(privateKey PrivateKey) bool
* Check if algorithm can sign data digest with a given key.
func (*Rsa) Decrypt ¶
func (obj *Rsa) Decrypt(privateKey PrivateKey, data []byte) ([]byte, error)
* Decrypt given data.
func (*Rsa) DecryptedLen ¶
func (obj *Rsa) DecryptedLen(privateKey PrivateKey, dataLen uint) uint
* Calculate required buffer length to hold the decrypted data.
func (*Rsa) EncryptedLen ¶
* Calculate required buffer length to hold the encrypted data.
func (*Rsa) ExportPrivateKey ¶
func (obj *Rsa) ExportPrivateKey(privateKey PrivateKey) (*RawPrivateKey, error)
* Export private key in the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA private key must be exported in format defined in * RFC 3447 Appendix A.1.2.
func (*Rsa) ExportPublicKey ¶
func (obj *Rsa) ExportPublicKey(publicKey PublicKey) (*RawPublicKey, error)
* Export public key to the raw binary format. * * Binary format must be defined in the key specification. * For instance, RSA public key must be exported in format defined in * RFC 3447 Appendix A.1.1.
func (*Rsa) GenerateEphemeralKey ¶
func (obj *Rsa) GenerateEphemeralKey(key Key) (PrivateKey, error)
* Generate ephemeral private key of the same type. * Note, this operation might be slow.
func (*Rsa) GenerateKey ¶
func (obj *Rsa) GenerateKey(bitlen uint) (PrivateKey, error)
* Generate new private key. * Note, this operation might be slow.
func (*Rsa) GetCanExportPrivateKey ¶
* Define whether a private key can be exported or not.
func (*Rsa) GetCanExportPublicKey ¶
* Define whether a public key can be exported or not.
func (*Rsa) GetCanImportPrivateKey ¶
* Define whether a private key can be imported or not.
func (*Rsa) GetCanImportPublicKey ¶
* Defines whether a public key can be imported or not.
func (*Rsa) ImportPrivateKey ¶
func (obj *Rsa) ImportPrivateKey(rawKey *RawPrivateKey) (PrivateKey, error)
* Import private key from the raw binary format. * * Return private key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA private key must be imported from the format defined in * RFC 3447 Appendix A.1.2.
func (*Rsa) ImportPublicKey ¶
func (obj *Rsa) ImportPublicKey(rawKey *RawPublicKey) (PublicKey, error)
* Import public key from the raw binary format. * * Return public key that is adopted and optimized to be used * with this particular algorithm. * * Binary format must be defined in the key specification. * For instance, RSA public key must be imported from the format defined in * RFC 3447 Appendix A.1.1.
func (*Rsa) SetupDefaults ¶
* Setup predefined values to the uninitialized class dependencies.
func (*Rsa) SignatureLen ¶
func (obj *Rsa) SignatureLen(privateKey PrivateKey) uint
* Return length in bytes required to hold signature. * Return zero if a given private key can not produce signatures.
type RsaPrivateKey ¶
type RsaPrivateKey struct {
// contains filtered or unexported fields
}
* Handles RSA private key.
func NewRsaPrivateKey ¶
func NewRsaPrivateKey() *RsaPrivateKey
func (*RsaPrivateKey) AlgId ¶
func (obj *RsaPrivateKey) AlgId() AlgId
* Algorithm identifier the key belongs to.
func (*RsaPrivateKey) AlgInfo ¶
func (obj *RsaPrivateKey) AlgInfo() (AlgInfo, error)
* Return algorithm information that can be used for serialization.
func (*RsaPrivateKey) ExtractPublicKey ¶
func (obj *RsaPrivateKey) ExtractPublicKey() (PublicKey, error)
* Extract public key from the private key.
func (*RsaPrivateKey) IsValid ¶
func (obj *RsaPrivateKey) IsValid() bool
* Check that key is valid. * Note, this operation can be slow.
type RsaPublicKey ¶
type RsaPublicKey struct {
// contains filtered or unexported fields
}
* Handles RSA public key.
func NewRsaPublicKey ¶
func NewRsaPublicKey() *RsaPublicKey
func (*RsaPublicKey) AlgId ¶
func (obj *RsaPublicKey) AlgId() AlgId
* Algorithm identifier the key belongs to.
func (*RsaPublicKey) AlgInfo ¶
func (obj *RsaPublicKey) AlgInfo() (AlgInfo, error)
* Return algorithm information that can be used for serialization.
func (*RsaPublicKey) IsValid ¶
func (obj *RsaPublicKey) IsValid() bool
* Check that key is valid. * Note, this operation can be slow.
func (*RsaPublicKey) KeyExponent ¶
func (obj *RsaPublicKey) KeyExponent() uint
* Return public key exponent.
type SaltedKdf ¶
type SaltedKdf interface { /* * Prepare algorithm to derive new key. */ Reset(salt []byte, iterationCount uint) /* * Setup application specific information (optional). * Can be empty. */ SetInfo(info []byte) /* * Release underlying C context. */ Delete() // contains filtered or unexported methods }
* Provides interface to the key derivation function (KDF) algorithms * that use salt and teration count.
func AlgFactoryCreateSaltedKdfFromInfo ¶
* Create algorithm that implements "salted kdf" interface.
func FoundationImplementationWrapSaltedKdf ¶
func FoundationImplementationWrapSaltedKdf(ctx *C.vscf_impl_t) (SaltedKdf, error)
Wrap C implementation object to the Go object that implements interface SaltedKdf.
type SaltedKdfAlgInfo ¶
type SaltedKdfAlgInfo struct {
// contains filtered or unexported fields
}
* Handle KDF algorithms that are configured with salt and iteration count.
func NewSaltedKdfAlgInfo ¶
func NewSaltedKdfAlgInfo() *SaltedKdfAlgInfo
func (*SaltedKdfAlgInfo) AlgId ¶
func (obj *SaltedKdfAlgInfo) AlgId() AlgId
* Provide algorithm identificator.
func (*SaltedKdfAlgInfo) Ctx ¶
func (obj *SaltedKdfAlgInfo) Ctx() uintptr
Handle underlying C context.
func (*SaltedKdfAlgInfo) Delete ¶
func (obj *SaltedKdfAlgInfo) Delete()
* Release underlying C context.
func (*SaltedKdfAlgInfo) HashAlgInfo ¶
func (obj *SaltedKdfAlgInfo) HashAlgInfo() (AlgInfo, error)
* Return hash algorithm information.
func (*SaltedKdfAlgInfo) IterationCount ¶
func (obj *SaltedKdfAlgInfo) IterationCount() uint
* Return KDF iteration count. * Note, can be 0 if KDF does not need the iteration count.
type Sec1Serializer ¶
type Sec1Serializer struct {
// contains filtered or unexported fields
}
* Implements SEC 1 key serialization to DER format. * See also RFC 5480 and RFC 5915.
func NewSec1Serializer ¶
func NewSec1Serializer() *Sec1Serializer
func (*Sec1Serializer) SerializePrivateKey ¶
func (obj *Sec1Serializer) SerializePrivateKey(privateKey *RawPrivateKey) ([]byte, error)
* Serialize given private key to an interchangeable format. * * Precondition: private key must be exportable.
func (*Sec1Serializer) SerializePrivateKeyInplace ¶
func (obj *Sec1Serializer) SerializePrivateKeyInplace(privateKey *RawPrivateKey) (uint, error)
* Serialize Private Key by using internal ASN.1 writer. * Note, that caller code is responsible to reset ASN.1 writer with * an output buffer.
func (*Sec1Serializer) SerializePublicKey ¶
func (obj *Sec1Serializer) SerializePublicKey(publicKey *RawPublicKey) ([]byte, error)
* Serialize given public key to an interchangeable format. * * Precondition: public key must be exportable.
func (*Sec1Serializer) SerializePublicKeyInplace ¶
func (obj *Sec1Serializer) SerializePublicKeyInplace(publicKey *RawPublicKey) (uint, error)
* Serialize Public Key by using internal ASN.1 writer. * Note, that caller code is responsible to reset ASN.1 writer with * an output buffer.
func (*Sec1Serializer) SerializedPrivateKeyLen ¶
func (obj *Sec1Serializer) SerializedPrivateKeyLen(privateKey *RawPrivateKey) uint
* Calculate buffer size enough to hold serialized private key. * * Precondition: private key must be exportable.
func (*Sec1Serializer) SerializedPublicKeyLen ¶
func (obj *Sec1Serializer) SerializedPublicKeyLen(publicKey *RawPublicKey) uint
* Calculate buffer size enough to hold serialized public key. * * Precondition: public key must be exportable.
func (*Sec1Serializer) SetAsn1Writer ¶
func (obj *Sec1Serializer) SetAsn1Writer(asn1Writer Asn1Writer)
func (*Sec1Serializer) SetupDefaults ¶
func (obj *Sec1Serializer) SetupDefaults()
* Setup predefined values to the uninitialized class dependencies.
type SeedEntropySource ¶
type SeedEntropySource struct {
// contains filtered or unexported fields
}
* Deterministic entropy source that is based only on the given seed.
func NewSeedEntropySource ¶
func NewSeedEntropySource() *SeedEntropySource
func (*SeedEntropySource) Ctx ¶
func (obj *SeedEntropySource) Ctx() uintptr
Handle underlying C context.
func (*SeedEntropySource) Delete ¶
func (obj *SeedEntropySource) Delete()
* Release underlying C context.
func (*SeedEntropySource) Gather ¶
func (obj *SeedEntropySource) Gather(len uint) ([]byte, error)
* Gather entropy of the requested length.
func (*SeedEntropySource) IsStrong ¶
func (obj *SeedEntropySource) IsStrong() bool
* Defines that implemented source is strong.
func (*SeedEntropySource) ResetSeed ¶
func (obj *SeedEntropySource) ResetSeed(seed []byte)
* Set a new seed as an entropy source.
type Sha224 ¶
type Sha224 struct {
// contains filtered or unexported fields
}
* This is MbedTLS implementation of SHA224.
func (*Sha224) GetBlockLen ¶
* Block length of the digest function in bytes.
func (*Sha224) GetDigestLen ¶
* Length of the digest (hashing output) in bytes.
func (*Sha224) ProduceAlgInfo ¶
* Produce object with algorithm information and configuration parameters.
func (*Sha224) RestoreAlgInfo ¶
* Restore algorithm configuration from the given object.
type Sha256 ¶
type Sha256 struct {
// contains filtered or unexported fields
}
* This is MbedTLS implementation of SHA256.
func (*Sha256) GetBlockLen ¶
* Block length of the digest function in bytes.
func (*Sha256) GetDigestLen ¶
* Length of the digest (hashing output) in bytes.
func (*Sha256) ProduceAlgInfo ¶
* Produce object with algorithm information and configuration parameters.
func (*Sha256) RestoreAlgInfo ¶
* Restore algorithm configuration from the given object.
type Sha384 ¶
type Sha384 struct {
// contains filtered or unexported fields
}
* This is MbedTLS implementation of SHA384.
func (*Sha384) GetBlockLen ¶
* Block length of the digest function in bytes.
func (*Sha384) GetDigestLen ¶
* Length of the digest (hashing output) in bytes.
func (*Sha384) ProduceAlgInfo ¶
* Produce object with algorithm information and configuration parameters.
func (*Sha384) RestoreAlgInfo ¶
* Restore algorithm configuration from the given object.
type Sha512 ¶
type Sha512 struct {
// contains filtered or unexported fields
}
* This is MbedTLS implementation of SHA512.
func (*Sha512) GetBlockLen ¶
* Block length of the digest function in bytes.
func (*Sha512) GetDigestLen ¶
* Length of the digest (hashing output) in bytes.
func (*Sha512) ProduceAlgInfo ¶
* Produce object with algorithm information and configuration parameters.
func (*Sha512) RestoreAlgInfo ¶
* Restore algorithm configuration from the given object.
type SignedDataInfo ¶
type SignedDataInfo struct {
// contains filtered or unexported fields
}
* Handle meta information about signed data.
func NewSignedDataInfo ¶
func NewSignedDataInfo() *SignedDataInfo
func (*SignedDataInfo) HashAlgInfo ¶
func (obj *SignedDataInfo) HashAlgInfo() (AlgInfo, error)
* Return information about algorithm that was used to produce data digest.
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
* Sign data of any size.
func (*Signer) AppendData ¶
* Add given data to the signed data.
func (*Signer) Sign ¶
func (obj *Signer) Sign(privateKey PrivateKey) ([]byte, error)
* Accomplish signing and return signature.
func (*Signer) SignatureLen ¶
func (obj *Signer) SignatureLen(privateKey PrivateKey) uint
* Return length of the signature.
type SignerInfo ¶
type SignerInfo struct {
// contains filtered or unexported fields
}
* Handle information about signer that is defined by an identifer and * a Public Key.
func NewSignerInfo ¶
func NewSignerInfo() *SignerInfo
func (*SignerInfo) SignerAlgInfo ¶
func (obj *SignerInfo) SignerAlgInfo() (AlgInfo, error)
* Return algorithm information that was used for data signing.
type SignerInfoList ¶
type SignerInfoList struct {
// contains filtered or unexported fields
}
* Handles a list of "signer info" class objects.
func NewSignerInfoList ¶
func NewSignerInfoList() *SignerInfoList
func (*SignerInfoList) HasItem ¶
func (obj *SignerInfoList) HasItem() bool
* Return true if given list has item.
func (*SignerInfoList) HasNext ¶
func (obj *SignerInfoList) HasNext() bool
* Return true if list has next item.
func (*SignerInfoList) HasPrev ¶
func (obj *SignerInfoList) HasPrev() bool
* Return true if list has previous item.
func (*SignerInfoList) Next ¶
func (obj *SignerInfoList) Next() *SignerInfoList
* Return next list node if exists, or NULL otherwise.
func (*SignerInfoList) Prev ¶
func (obj *SignerInfoList) Prev() *SignerInfoList
* Return previous list node if exists, or NULL otherwise.
type SimpleAlgInfo ¶
type SimpleAlgInfo struct {
// contains filtered or unexported fields
}
* Handle simple algorithm information (just id).
func NewSimpleAlgInfo ¶
func NewSimpleAlgInfo() *SimpleAlgInfo
func NewSimpleAlgInfoWithAlgId ¶
func NewSimpleAlgInfoWithAlgId(algId AlgId) *SimpleAlgInfo
* Create algorithm info with identificator.
func (*SimpleAlgInfo) AlgId ¶
func (obj *SimpleAlgInfo) AlgId() AlgId
* Provide algorithm identificator.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
* Verify data of any size. * Compatible with the class "signer".
func NewVerifier ¶
func NewVerifier() *Verifier
func (*Verifier) AppendData ¶
* Add given data to the signed data.
Source Files ¶
- aes256_cbc.go
- aes256_gcm.go
- alg.go
- alg_factory.go
- alg_id.go
- alg_info.go
- alg_info_der_deserializer.go
- alg_info_der_serializer.go
- alg_info_deserializer.go
- alg_info_serializer.go
- asn1_reader.go
- asn1_tag.go
- asn1_writer.go
- asn1rd.go
- asn1wr.go
- auth_decrypt.go
- auth_encrypt.go
- base64.go
- brainkey_client.go
- brainkey_server.go
- cipher.go
- cipher_alg_info.go
- cipher_auth.go
- cipher_auth_info.go
- cipher_info.go
- cipher_state.go
- compound_key_alg.go
- compound_key_alg_info.go
- compound_private_key.go
- compound_public_key.go
- compute_shared_key.go
- context.go
- ctr_drbg.go
- curve25519.go
- decrypt.go
- ecc.go
- ecc_alg_info.go
- ecc_private_key.go
- ecc_public_key.go
- ecies.go
- ed25519.go
- encrypt.go
- entropy_accumulator.go
- entropy_source.go
- fake_random.go
- falcon.go
- footer_info.go
- foundation_error.go
- foundation_implementation.go
- group_msg_type.go
- group_session.go
- group_session_message.go
- group_session_ticket.go
- hash.go
- hash_based_alg_info.go
- helper.go
- hkdf.go
- hmac.go
- hybrid_key_alg.go
- hybrid_key_alg_info.go
- hybrid_private_key.go
- hybrid_public_key.go
- kdf.go
- kdf1.go
- kdf2.go
- kem.go
- key.go
- key_alg.go
- key_alg_factory.go
- key_asn1_deserializer.go
- key_asn1_serializer.go
- key_cipher.go
- key_deserializer.go
- key_info.go
- key_material_rng.go
- key_provider.go
- key_recipient_info.go
- key_recipient_info_list.go
- key_serializer.go
- key_signer.go
- mac.go
- message_info.go
- message_info_custom_params.go
- message_info_der_serializer.go
- message_info_editor.go
- message_info_footer.go
- message_info_footer_serializer.go
- message_info_serializer.go
- oid.go
- oid_id.go
- padding.go
- padding_params.go
- password_recipient_info.go
- password_recipient_info_list.go
- pbe_alg_info.go
- pem.go
- pkcs5_pbes2.go
- pkcs5_pbkdf2.go
- pkcs8_serializer.go
- platform.go
- private_key.go
- public_key.go
- random.go
- random_padding.go
- raw_private_key.go
- raw_public_key.go
- recipient_cipher.go
- round5.go
- rsa.go
- rsa_private_key.go
- rsa_public_key.go
- salted_kdf.go
- salted_kdf_alg_info.go
- sec1_serializer.go
- seed_entropy_source.go
- sha224.go
- sha256.go
- sha384.go
- sha512.go
- signed_data_info.go
- signer.go
- signer_info.go
- signer_info_list.go
- simple_alg_info.go
- verifier.go