Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SerializeSoterContainer ¶
SerializeSoterContainer packs the tagged payload into a Soter container.
This is a convenience method to quickly pack the payload into a byte slice.
Types ¶
type AlgorithmID ¶
type AlgorithmID uint32
AlgorithmID encodes symmetric algorithm parameters for Soter.
func MakeAlgorithmID ¶
func MakeAlgorithmID(algorithm SymmetricAlgorithm, kdf KeyDerivationFunction, padding PaddingAlgorithm, keyBits int) AlgorithmID
MakeAlgorithmID constructs algorithm ID from components.
func (AlgorithmID) Algorithm ¶
func (id AlgorithmID) Algorithm() SymmetricAlgorithm
Algorithm returns symmetric algorithm component.
func (AlgorithmID) KDF ¶
func (id AlgorithmID) KDF() KeyDerivationFunction
KDF returns key derivation function.
func (AlgorithmID) KeyBits ¶
func (id AlgorithmID) KeyBits() int
KeyBits returns size of the key in bits.
func (AlgorithmID) Padding ¶
func (id AlgorithmID) Padding() PaddingAlgorithm
Padding returns padding algorithm.
type KeyDerivationFunction ¶
type KeyDerivationFunction int
KeyDerivationFunction indicates key derivation function in AlgorithmID.
const ( NoKDF KeyDerivationFunction = 0x0 PBKDF2HmacSha256 KeyDerivationFunction = 0x1 )
Supported KeyDerivationFunction values.
type PaddingAlgorithm ¶
type PaddingAlgorithm int
PaddingAlgorithm indicates padding algorithm in AlgorithmID.
const ( NoPadding PaddingAlgorithm = 0x0 PKCS7Padding PaddingAlgorithm = 0x1 )
Supported PaddingAlgorithm values.
type SoterContainer ¶
SoterContainer is a lightweight data container with basic integrity checks.
func NewSoterContainer ¶
func NewSoterContainer(tag string, payload []byte) *SoterContainer
NewSoterContainer makes a new Soter container with given tag and payload.
This is a convenience method so that you don't have to deal with arrays, as most of Themis tags are actually strings.
func ParseSoterContainer ¶
func ParseSoterContainer(buffer []byte) (*SoterContainer, []byte)
ParseSoterContainer extracts and validates a Soter container from the buffer. It also returns the remaining part of the buffer.
func (*SoterContainer) Checksum ¶
func (container *SoterContainer) Checksum() []byte
Checksum computes CRC checksum of this container.
func (*SoterContainer) Serialize ¶
func (container *SoterContainer) Serialize(buffer []byte) []byte
Serialize this container, append it to the given buffer, and return it.
func (*SoterContainer) Tag ¶
func (container *SoterContainer) Tag() string
Tag returns Soter container tag as a string.
type SymmetricAlgorithm ¶
type SymmetricAlgorithm int
SymmetricAlgorithm indicates symmetric encryption algorithm in AlgorithmID.
const ( AesECB SymmetricAlgorithm = 0x1 AesCBC SymmetricAlgorithm = 0x2 AesXTS SymmetricAlgorithm = 0x3 AesGCM SymmetricAlgorithm = 0x4 )
Supported SymmetricAlgorithm values.