Cryptography

详细描述

Namespaces

  maxon::StreamConversions
  maxon::BLOWFISHLEGACYENDECODER_OPTIONS
  maxon::HASH_HMAC
  maxon::CryptographyOptions

Classes

class   CryptographyStreamConversionInterface
class   CryptoKeyInterface
class   CryptoKey

Typedefs

using  BLOCK_CIPHER_CTR_CALLBACK = Delegate < void( Int block, Int blockSize, UChar *nonce)>

Enumerations

enum   BLOCK_CIPHER_MODE : UInt64 {
   ECB ,
   CBC ,
   PCBC ,
   CFB ,
   OFB ,
   CTR ,
   KEEP_STATE
}

函数

enum maxon::BLOCK_CIPHER_MODE UInt64   MAXON_ENUM_FLAGS ( BLOCK_CIPHER_MODE )
Result < String GetHashString (const BaseArray < UChar > &hashValue)
Result < String GetPasswordHash (const String &password, const StreamConversionFactory &hashClass, const DataDictionary &settings=DataDictionary())
Result < Tuple < String , String > >  HashPasswordWithSalt (const String &password, const StreamConversionFactory &hashClass=StreamConversions::HashSHA256())
Result < void >  AddConversionTestSetting ( MAXON_SOURCE_LOCATION_DECLARATION , BaseArray < DataDictionary > &resultArray, const Id &encoderId, const Id &decoderId, 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 (), const Char *srcData=nullptr, const Char *compareData=nullptr)

Typedef Documentation

◆  BLOCK_CIPHER_CTR_CALLBACK

using BLOCK_CIPHER_CTR_CALLBACK = Delegate <void( Int block, Int blockSize, UChar * nonce)>

param[in] block The block number. param[in] blockSize The size in bytes. param[in] userData User data that was originally passed to the Encrypt and Decrypt function. param[out] nonce A buffer that is filled with the Nonce data. You may only write blockSize bytes.

Enumeration Type Documentation

◆  BLOCK_CIPHER_MODE

enum BLOCK_CIPHER_MODE : UInt64
strong

Block cipher modes. See documentation of the encryption method for details.

Enumerator
ECB 

Electronic codebook.

CBC 

Cipher-block chaining.

PCBC 

Propagating cipher-block chaining.

CFB 

Cipher feedback.

OFB 

Output feedback.

CTR 

Counter.

KEEP_STATE 

for CBC, PCBC, CFB, OFB: Store the current state in the instance. Otherwise the next Encrypt call will use the original initialization vector.

Function Documentation

◆  MAXON_ENUM_FLAGS()

enum maxon::BLOCK_CIPHER_MODE UInt64 maxon::MAXON_ENUM_FLAGS ( BLOCK_CIPHER_MODE   )

◆  GetHashString()

Result < String > maxon::GetHashString ( const BaseArray < UChar > &  hashValue )

Returns the hash value as a hexadecimal string. The length of the value depends on the algorithm.

参数
[in] hashValue The input (byte) values.
返回
The hexadecimal string.

◆  GetPasswordHash()

Result < String > maxon::GetPasswordHash ( const String password ,
const StreamConversionFactory hashClass ,
const DataDictionary &  settings = DataDictionary()  
)

Returns the hash value string of a password.

参数
[in] password The input password.
[in] hashClass The algorithm to use, e.g. StreamConversions::HashMD5()
[in] settings Settings for the hash algorithm which will be passed to the Init() function.
返回
The hash value string.

◆  HashPasswordWithSalt()

Result < Tuple < String , String > > maxon::HashPasswordWithSalt ( const String password ,
const StreamConversionFactory hashClass = StreamConversions::HashSHA256()  
)

HashPasswdWithSalt creates a unique salt string and hashes the password together with the string hash(salt + password). To verify a password you need to store the salt and call "String hashedPasswd = GetPasswordHash(passwordSalt + passwd, StreamConversions::HashSHA256())" to get the hashed passwd.

参数
[in] password Password to hash.
[in] hashClass HashClass to use.
返回
Tuple<salt, passwordhash> if no error occurred.

◆  AddConversionTestSetting()

Result <void> maxon::AddConversionTestSetting ( MAXON_SOURCE_LOCATION_DECLARATION   ,
BaseArray < DataDictionary > &  resultArray ,
const Id encoderId ,
const Id decoderId ,
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() ,
const Char srcData = nullptr ,
const Char compareData = nullptr  
)

Helper function to add crypto tests.