5using System.Threading.Tasks;
32 : base(
"Storage/CreateVaultLink",
33 new KeyValuePair<Type,
Expression>(typeof(Dictionary<string, object>), new
Expression(jsonPattern)),
53 string KeyId = (string)Parameters[
"PKeyId"].AssociatedObjectValue;
54 string Nonce = (string)Parameters[
"PNonce"].AssociatedObjectValue;
55 string KeySignature = (string)Parameters[
"PKeySignature"].AssociatedObjectValue;
56 string RequestSignature = (string)Parameters[
"PRequestSignature"].AssociatedObjectValue;
57 string VaultId = (string)Parameters[
"PVaultId"]?.AssociatedObjectValue;
58 int Ttl = (int)(
double)(Parameters[
"PTtl"]?.AssociatedObjectValue ?? 0.0);
59 int UseCount = (int)(
double)(Parameters[
"PUseCount"]?.AssociatedObjectValue ?? 0.0);
60 bool Masked = (bool)(Parameters[
"PMasked"]?.AssociatedObjectValue ??
true);
65 VaultIdBin = Convert.FromBase64String(VaultId);
72 if (
string.IsNullOrEmpty(KeyId))
75 if (
string.IsNullOrEmpty(Nonce) || Nonce.Length < 32)
78 StringBuilder sb =
new StringBuilder();
97 sb.Append(KeySignature);
99 string s2 = sb.ToString();
110 sb.Append(Masked ?
'1' :
'0');
118 string s3 = sb.ToString();
120 string s = Convert.ToBase64String(
123 Encoding.UTF8.GetBytes(s3)));
125 if (s != RequestSignature)
137 VaultId = VaultIdBin,
139 Expires = Ttl > 0 ? DateTime.UtcNow.AddSeconds(Ttl) : DateTime.MaxValue,
148 sb.Append(
"/Vault/");
152 byte[] Signature = KeyEndpoint.
Sign(Encoding.UTF8.GetBytes(sb.ToString()));
Static class that does BASE64URL encoding (using URL and filename safe alphabet), as defined in RFC46...
static string Encode(byte[] Data)
Converts a binary block of data to a Base64URL-encoded string.
A Named dictionary is a dictionary, with a local name and a namespace. Use it to return content that ...
Static class managing the runtime environment of the IoT Gateway.
static Task< bool > HasNonceBeenUsed(string Nonce)
Checks if a Nonce value has been used.
static string GetUrl(string LocalResource)
Gets a URL for a resource.
static Task RegisterNonceValue(string Nonce)
Registers a nonce value.
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.
HttpServer Server
HTTP Server receiving the request.
Represets a response of an HTTP client request.
Task Return(Exception ex)
Returns an error to the client.
HttpResource Register(HttpResource Resource)
Registers a resource with the server.
bool TryGetResource(HttpRequest Request, out HttpResource Resource, out string SubPath)
Tries to get a resource from the server.
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.
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
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.
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.
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.
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
Creates a link to a vault item that can be shared with a third party.
override async Task POST(HttpRequest Request, HttpResponse Response, Dictionary< string, IElement > Parameters)
Executes the POST method on the resource.
CreateVaultLink()
> Creates a link to a vault item that can be shared with a third party.
Stores information in the Encrypted Vault.
Contains information about an item in the Vault.
string Account
Account name.
Contains a reference to a vault item.
Access to secured vault storage via signed URLs.