notary / shareandcharge.openchargingnetwork.notary / Notary

Notary

class Notary

The Open Charging Network Notary signs OCPI requests and verifies OCN Signatures.

Constructors

<init>

The Open Charging Network Notary signs OCPI requests and verifies OCN Signatures.

Notary()

Properties

fields

The list of fields whose values are included in the signature. The order of the fields is relevant for the verification. Follows JsonPath notation.

var fields: MutableList<String>

hash

The hash of the values in the fields list (this is the value that gets signed).

var hash: String

rewrites

If the value of one (or more) of the fields had to be overwritten by the OCN node, it must add this value to the list of rewrites in order to allow the recipient of the message to still be able to validate the original message.

var rewrites: MutableList<Rewrite>

rsv

The concatenated parts of a signature R + S + V The result is a 130 hex characters string.

var rsv: String

signatory

The 40 bytes public Ethereum address of the signatory.

var signatory: String

Functions

serialize

Serialize an OCN Notary object into a base64-encoded JSON string

fun serialize(): String

sign

Create the signature based on an OcpiRequest object containing headers, url-encoded parameters and a generic body.

fun sign(valuesToSign: OcpiRequest<*>, privateKey: String): Notary

stash

Add a rewrite to the Notary object.

fun stash(rewrittenFields: Map<String, Any?>): Notary

verify

Verify that the signature was correctly signed by the provided signatory.

fun verify(valuesToVerify: OcpiRequest<*>): VerifyResult

Companion Object Functions

compress

Compress signature using Brotli

fun compress(input: ByteArray): ByteArray

decompress

Decompress signature using Brotli

fun decompress(input: ByteArray): ByteArray

deserialize

Deserialize an OCN-Signature header (base64-encoded JSON-serialized string) into a Notary object which can verify the request.

fun deserialize(ocnSignature: String): Notary