WALTER | Workable Algorithms for Location-aware Transmission, Encryption Response

DeterministicEncryption..::..TryEncrypt Method

Tries to encrypt the given byte array.

Namespace:  Walter.Cypher
Assembly:  Walter.Cypher (in Walter.Cypher.dll)

Syntax


public bool TryEncrypt(
	byte[] clearBytes,
	out Nullable<byte>[] cypherBytes,
	out Nullable<byte>[] hash
)

Parameters

clearBytes
Type: array<Byte>[]()[][]
The clear bytes to encrypt.
cypherBytes
Type: array<Nullable<(Of <(<'Byte>)>)>>[]()[][]%
The encrypted bytes (cipher bytes) if encryption succeeds; otherwise, null.
hash
Type: array<Nullable<(Of <(<'Byte>)>)>>[]()[][]%
The computed hash of the cipher bytes if encryption succeeds; otherwise, null.

Return Value

true if encryption and hash computation succeed; false otherwise.

Exceptions


ExceptionCondition
ExceptionThrown when no ILogger is provided and an exception occurs during encryption.

Remarks


This method attempts to encrypt the provided byte array. If the encryption is successful, it also computes a hash of the cipher bytes using the specified hash method. An exception is thrown if no ILogger is provided and an error occurs during encryption.