Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
RS256.cs
1using System.Security.Cryptography;
2using Waher.Script;
7
9{
14 {
23 {
24 }
25
34 : base(new ScriptNode[] { Rsa }, argumentTypes1Scalar, Start, Length, Expression)
35 {
36 }
37
41 public override string FunctionName => nameof(RS256);
42
46 public override string[] DefaultArgumentNames => new string[] { "Rsa" };
47
55 {
56 if (Arguments.Length == 0)
57 return new ObjectValue(new RsaSsaPkcsSha256());
58
59 object Obj = Arguments[0].AssociatedObjectValue;
60
61 if (Obj is RSA Rsa)
62 return new ObjectValue(new RsaSsaPkcsSha256(Rsa));
63 else if (Obj is RSAParameters Parameters)
64 return new ObjectValue(new RsaSsaPkcsSha256(Parameters));
65 else if (Obj is double NrBits)
66 return new ObjectValue(new RsaSsaPkcsSha256((int)NrBits));
67 else
68 throw new ScriptRuntimeException("Expected argument to be an RSA object, RSAParameters object, or a number of bits.", this);
69 }
70 }
71}
Class managing a script expression.
Definition: Expression.cs:39
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
static readonly ArgumentType[] argumentTypes0
Zero parameters.
static readonly ArgumentType[] argumentTypes1Scalar
One scalar parameter.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
Expression Expression
Expression of which the node is a part.
Definition: ScriptNode.cs:177
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Creates an RSASSA-PKCS1-v1_5 SHA-256 JSON Web Signature key.
Definition: RS256.cs:14
RS256(int Start, int Length, Expression Expression)
Creates an RSASSA-PKCS1-v1_5 SHA-256 JSON Web Signature key.
Definition: RS256.cs:21
override string[] DefaultArgumentNames
Default Argument names
Definition: RS256.cs:46
RS256(ScriptNode Rsa, int Start, int Length, Expression Expression)
Creates an RSASSA-PKCS1-v1_5 SHA-256 JSON Web Signature key.
Definition: RS256.cs:33
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Definition: RS256.cs:54
override string FunctionName
Name of the function
Definition: RS256.cs:41
RSASSA-PKCS1-v1_5 SHA-256 algorithm. https://tools.ietf.org/html/rfc3447#page-32
Basic interface for all types of elements.
Definition: IElement.cs:20