2using System.Security.Cryptography;
68 public override string[]
DefaultArgumentNames =>
new string[] {
"Content",
"Key",
"IV",
"CipherMode",
"PaddingMode" };
78 if (!(
Arguments[0].AssociatedObjectValue is
byte[] Data))
81 if (!(
Arguments[1].AssociatedObjectValue is
byte[] Key))
82 throw new ScriptRuntimeException(
"Key to use for encryption must be binary (i.e. an array of bytes).",
this);
84 if (!(
Arguments[2].AssociatedObjectValue is
byte[] IV))
85 throw new ScriptRuntimeException(
"Initiation Vector to use for encryption must be binary (i.e. an array of bytes).",
this);
88 CipherMode CipherMode = c <= 3 ? CipherMode.CBC : this.ToEnum<CipherMode>(
Arguments[3]);
89 PaddingMode PaddingMode = c <= 4 ? PaddingMode.PKCS7 : this.ToEnum<PaddingMode>(
Arguments[4]);
91 using (Aes Aes = Aes.Create())
95 Aes.Mode = CipherMode;
96 Aes.Padding = PaddingMode;
98 using (ICryptoTransform Transform = Aes.CreateEncryptor(Key, IV))
100 byte[] Encrypted = Transform.TransformFinalBlock(Data, 0, Data.Length);
Aes256Encrypt(ScriptNode Content, ScriptNode Key, ScriptNode IV, ScriptNode CipherMode, ScriptNode PaddingMode, int Start, int Length, Expression Expression)
AES Encryption
override string[] DefaultArgumentNames
Default Argument names
override string FunctionName
Name of the function
Aes256Encrypt(ScriptNode Content, ScriptNode Key, ScriptNode IV, int Start, int Length, Expression Expression)
AES Encryption
Aes256Encrypt(ScriptNode Content, ScriptNode Key, ScriptNode IV, ScriptNode CipherMode, int Start, int Length, Expression Expression)
AES Encryption
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Script runtime exception.
Class managing a script expression.
Base class for multivariate funcions.
static readonly ArgumentType[] argumentTypes3Normal
Three normal parameters.
static readonly ArgumentType[] argumentTypes4Normal
Four normal parameters.
ScriptNode[] Arguments
Function arguments.
static readonly ArgumentType[] argumentTypes5Normal
Five normal parameters.
Base class for all nodes in a parsed script tree.
int Length
Length of expression covered by node.
Expression Expression
Expression of which the node is a part.
int Start
Start position in script expression.
Basic interface for all types of elements.