CryptoSys PKI Pro Manual

Cipher.Decrypt(Byte[], Byte[], Byte[], CipherAlgorithm, Mode, Padding, Cipher.Opts) Method

Decrypt data in a byte array using the specified block cipher algorithm, mode and padding.

Syntax

[C#]
public static byte[] Decrypt(
   byte[] input,
   byte[] key,
   byte[] iv,
   CipherAlgorithm cipherAlg,
   Mode mode,
   Padding pad = Padding.Default,
   Cipher.Opts opts = Cipher.Opts.Default 
)
[VB]
Public Shared Function Decrypt (
   input As Byte(),
   key As Byte(),
   iv As Byte(),
   cipherAlg As CipherAlgorithm,
   mode As Mode,
   Optional pad As Padding = Padding.Default,
   Optional opts As Cipher.Opts = Cipher.Opts.Default 
) As Byte()

Parameters

input  Byte
Input data to be decrypted
key  Byte
Key of exact length for block cipher algorithm
iv  Byte
Initialization Vector (IV) of exactly the block size, or null for ECB mode or if IV is prefixed.
cipherAlg  CipherAlgorithm
Cipher algorithm
mode  Mode
Cipher mode
pad  Padding  (Optional)
Padding method to use
opts  Cipher.Opts  (Optional)
Advanced options. Use Cipher.Opts.PrefixIV to expect the IV to be prepended to the input.

Return Value

Byte
Decrypted plaintext in byte array or empty array on error

Remarks

Default padding is Pkcs5 for ECB and CBC mode and NoPad for all other modes. It is an error if the specified padding is not found after decryption.

See Also

VB6/C equivalent: CIPHER_DecryptBytes

[Contents] [Index]

[PREV: Cipher.Decrypt(Byte, Byte, Byte, CipherAlgorithm, Mode) Method...]   [Contents]   [Index]   
   [NEXT: Cipher.Decrypt(String, String, String, CipherAlgorithm, Mode) Method...]

Copyright © 2004-26 D.I. Management Services Pty Ltd t/a CryptoSys. All rights reserved. Generated 2026-09-21T05:59:39Z.