2using System.Collections.Generic;
4using System.Threading.Tasks;
30 : base(
"Legal/SignData",
31 new KeyValuePair<Type,
Expression>(typeof(Dictionary<string, object>), new
Expression(jsonPattern)),
57 string KeyId = (string)Parameters[
"PKeyId"].AssociatedObjectValue;
59 string DataBase64 = (string)Parameters[
"PDataBase64"].AssociatedObjectValue;
60 string KeySignature = (string)Parameters[
"PKeySignature"].AssociatedObjectValue;
61 string RequestSignature = (string)Parameters[
"PRequestSignature"].AssociatedObjectValue;
64 if (
string.IsNullOrEmpty(KeyId))
69 Data = Convert.FromBase64String(DataBase64);
79 if (Identity.Account != User.
UserName)
80 throw new ForbiddenException(
"Only allowed to add attachments to your own legal identities.");
90 StringBuilder sb =
new StringBuilder();
105 sb.Append(KeySignature);
107 string s2 = sb.ToString();
110 sb.Append(DataBase64);
114 string s3 = sb.ToString();
116 string s = Convert.ToBase64String(
119 Encoding.UTF8.GetBytes(s3)));
121 if (s != RequestSignature)
123 string Msg =
"Request Signature invalid.";
128 byte[] Signature = KeyEndpoint.
Sign(Data);
132 {
"Signature", Convert.ToBase64String(Signature) }
A Named dictionary is a dictionary, with a local name and a namespace. Use it to return content that ...
Static class managing loading of resources stored as embedded resources or in content files.
static string LoadResourceAsText(string ResourceName)
Loads a text resource from an embedded resource.
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repe...
The server understood the request, but is refusing to fulfill it. Authorization will not help and the...
Represents an HTTP request.
HttpRequestHeader Header
Request header.
Represets a response of an HTTP client request.
async Task Return(object Object)
Returns an object to the client. This method can only be called once per response,...
The server has not found anything matching the Request-URI. No indication is given of whether the con...
Abstract base class for Elliptic Curve endpoints.
override byte[] Sign(byte[] Data)
Signs binary data using the local private key.
Represents a case-insensitive string.
Static interface for database persistence. In order to work, a database provider has to be assigned t...
This filter selects objects that conform to all child-filters provided.
This filter selects objects that have a named field equal to a given value.
Class managing a script expression.
Contains methods for simple hash calculations.
static byte[] ComputeHMACSHA256Hash(byte[] Key, byte[] Data)
Computes the HMAC-SHA-256 hash of a block of binary data.
string Password
Password of account
Account Account
Account object.
string UserName
User Name.
Provisioning and registry service component.
Abstract base class for agent resources supporting the POST method.
static AccountUser AssertUserAuthenticated(HttpRequest Request)
Makes sure the request is made by an authenticated API user.
const string AgentNamespace
https://waher.se/Schema/BrokerAgent.xsd
Contains an encrypted key for an agent.
string Namespace
Namespace of algorithm
string LocalName
Local Name of algorithm
Applies for a new Legal ID
Signs binary data using a legal ID.
override async Task POST(HttpRequest Request, HttpResponse Response, Dictionary< string, IElement > Parameters)
Executes the POST method on the resource.
override bool Synchronous
If the resource is synchronous (i.e. returns a response in the method handler), or if it is asynchron...
SignData()
Signs binary data using a legal ID.
IdentityState
Lists recognized legal identity states.