CipherEncrypt(Byte, Byte, Byte, CipherAlgorithm, Mode, Padding, CipherOpts) Method |
Encrypt data in a byte array using the specified block cipher algorithm, mode and padding.
Namespace: CryptoSysPKIAssembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.30549 (23.1.0.0)
Syntaxpublic static byte[] Encrypt(
byte[] input,
byte[] key,
byte[] iv,
CipherAlgorithm cipherAlg,
Mode mode,
Padding pad = Padding.Default,
CipherOpts opts = CipherOpts.Default
)
Public Shared Function Encrypt (
input As Byte(),
key As Byte(),
iv As Byte(),
cipherAlg As CipherAlgorithm,
mode As Mode,
Optional pad As Padding = Padding.Default,
Optional opts As CipherOpts = CipherOpts.Default
) As Byte()
Parameters
- input Byte
- Input data to be encrypted
- 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.
- cipherAlg CipherAlgorithm
- Cipher algorithm
- mode Mode
- Cipher mode
- pad Padding (Optional)
- Padding method to use
- opts CipherOpts (Optional)
- Advanced options. Use Cipher.Opts.PrefixIV
to prepend the IV to the output.
Return Value
ByteCiphertext in byte array or empty array on error
RemarksDefault padding is Pkcs5 for ECB and CBC mode and
NoPad for all other modes.
See Also