CryptoKey Class Reference

#include <cryptography_key.h>

Inheritance diagram for CryptoKey:

Detailed Description

Reference counted class of CryptoKeyInterface.

Public Member Functions

 MAXON_DEFAULT_REFERENCE_CONSTRUCTORS (CryptoKey, Reference)
 
 CryptoKey (const Id &cryptoAlgorithm, Int blockSizeBits, const void *key1, Int key1BitSize, const void *key2=nullptr, Int key2BitSize=0, UInt64 flags=0, BLOCK_CIPHER_CTR_CALLBACK &&callback=BLOCK_CIPHER_CTR_CALLBACK())
 
Result< UrlEmbedStreamName (const Url &unencryptedStream)
 

Static Private Member Functions

static CryptoKeyInterfaceCreateInterface (const Id &cryptoAlgorithm, Int blockSizeBits, const void *key1, Int key1BitSize, const void *key2, Int key2BitSize, UInt64 flags, BLOCK_CIPHER_CTR_CALLBACK &&callback)
 

Constructor & Destructor Documentation

◆ CryptoKey()

CryptoKey ( const Id cryptoAlgorithm,
Int  blockSizeBits,
const void *  key1,
Int  key1BitSize,
const void *  key2 = nullptr,
Int  key2BitSize = 0,
UInt64  flags = 0,
BLOCK_CIPHER_CTR_CALLBACK &&  callback = BLOCK_CIPHER_CTR_CALLBACK() 
)

Allocates the class.

Parameters
[in]cryptoAlgorithmId of an encryption algorithm. e.g. StreamConversions::AesEncoder.GetId().
[in]blockSizeBitsBlocksize of the algorithm in bits.
[in]key1Pointer to the data of key 1.
[in]key1BitSizeSize of the key 1 in bits.
[in]key2Pointer to the data of key 2.
[in]key2BitSizeSize of the key 2 in bits.
[in]flagsAdditional flags.
[in]callbackCallback function for CTR mode.

Member Function Documentation

◆ MAXON_DEFAULT_REFERENCE_CONSTRUCTORS()

MAXON_DEFAULT_REFERENCE_CONSTRUCTORS ( CryptoKey  ,
Reference   
)

◆ EmbedStreamName()

Result<Url> EmbedStreamName ( const Url unencryptedStream)

Returns a new Url where the given stream name is wrapped into a URLSCHEME_CRYPTOFILE with the given crypto key. This allows to do file en-/decryption on the fly when reading/writing streams.

Parameters
[in]unencryptedStreamThe stream name of the unencrypted stream.
Returns
Returns a new Url which can be used as encrypted io stream.

◆ CreateInterface()

static CryptoKeyInterface* CreateInterface ( const Id cryptoAlgorithm,
Int  blockSizeBits,
const void *  key1,
Int  key1BitSize,
const void *  key2,
Int  key2BitSize,
UInt64  flags,
BLOCK_CIPHER_CTR_CALLBACK &&  callback 
)
staticprivate