CryptoSys API Library Manual
Cipher.Encrypt Method (String, String, String, CipherAlgorithm, Mode, Padding, Cipher.Opts)
Encrypt hex-encoded data using specified block cipher algorithm, mode and padding.
Syntax
[C#]
public static string Encrypt(
string inputHex,
string keyHex,
string ivHex,
CipherAlgorithm cipherAlg,
Mode mode,
Padding pad,
Cipher.Opts opts
)
[VB.NET]
Public Shared Function Encrypt ( _
inputHex As String, _
keyHex As String, _
ivHex As String, _
cipherAlg As CipherAlgorithm, _
mode As Mode, _
pad As Padding, _
opts As Cipher.Opts _
) As String
Parameters
- inputHex
- Hex-encoded input data
- keyHex
- Hex-encoded key representing exact key length
- ivHex
- Hex-encoded IV representing exact block length or "" for ECB mode
- cipherAlg
- Type: CipherAlgorithm
Cipher Algorithm
- mode
- Type: Mode
Cipher Mode
- pad
- Type: Padding
Padding method to use
- opts
- Type: Cipher.Opts
Advanced options (optional). Use Cipher.Opts.PrefixIV to prepend the IV to the output.
Return Value
Encrypted ciphertext in hex-encoded string or empty string on error
Remarks
Input data may be any even number of hex characters, but not zero. Default padding is Pkcs5 for ECB and CBC mode and NoPad for all other modes.
See Also
VB6/C equivalent: CIPHER_EncryptHex
[Contents] [Index]