Table of Contents
/Crypto/GetPublicKey
Allows the client to get the current server public key, or the public key of one of its own cryptographic keys. The client can use this key to validate signatures server in relation to legal identities, smart contracts, tokens, etc.
Note: If a Key ID is provided, information about one of the keys of the client account is returned. If not Key ID is provided, information about the the public server key is returned.
JSON
- Request
{ "keyId": Optional(Str(PKeyId)) }
- Response (if successful)
{ "key": Required(Str(PKey)), "Algorithm": { "localName":Required(Str(PLocalName)), "namespace":Required(Str(PNamespace)), "securityStrength":Required(Int(PSecurityStrength)), "safe":Required(Boolean(PSafe)), "slow":Required(Boolean(PSlow)), "score":Required(Int(PScore)) } }
XML
- Request
<GetPublicKey xmlns="https://waher.se/Schema/BrokerAgent.xsd" keyId=(Optional(Str(PKeyId)))/>
- Response (if successful)
<PublicKey xmlns="https://waher.se/Schema/BrokerAgent.xsd" key=(Required(Str(PKey)))> <Algorithm localName=(Required(Str(PLocalName))) namespace=(Required(Str(PNamespace))) securityStrength=(Required(Int(PSecurityStrength))) safe=(Required(Boolean(PSafe))) slow=(Required(Boolean(PSlow))) score=(Required(Int(PScore))) /> </PublicKey>
Input Parameters
Parameter | Description |
---|---|
PKeyId |
Optional Key ID. If not provided, the server public key is returned. If provided, the public key of the corresponding cryptographic key of the client is returned. |
Response Parameters
Parameter | Description |
---|---|
PKey |
Base64-encoded public key of the server. |
PLocalName |
Local Name of the algorithm. |
PNamespace |
Namespace, defining the algorithm. |
PSecurityStrength |
Security strength of algorithm (in bits). |
PSafe |
If the algorithm is considered safe according to https://safecurves.cr.yp.to/. |
PSlow |
If the algorithm is slow (i.e. computation intensive). |
PScore |
Algorithm score. Can be used, together with PSecurityStrength to order algorithms. |
Javascript Library
Use the following asynchronous method in the Javascript Library, to call this resource.
var Response = await AgentAPI.Crypto.GetPublicKey(KeyId);