KEY.PRIV

KEY.PRIV validates the format of the private member of a public/private key pair then returns a hashed and Base64 encoded digest.

If the key is not valid or cannot be extracted, KEY.PRIV will throw an error. It is designed for use within the Xapix system.

Function category: Key

Syntax

KEY.PRIV(arg1)

Arguments

Description

arg1

Private key of a public/private key pair.

Example

Let's say we are given the following private key.

{
"keys": {
"private": "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEINCzFsHTrgu6zJMGR+HHWxNZDrV69EOzmb7mSOJ0+J3soAoGCCqGSM49AwEHoUQDQgAEdOaYkK\ntVJrSWFmBnZvjofkjMNqL84PdCIKp85JglpuM9m11Pg2JvUkFefPmR48p0SxJoTNyC9oZ9wA3KFTcNXA==\n-----END EC PRIVATE KEY-----\n"
}
}

If we wanted to extract and validate the token with the key above, use the following function.

# Validate the token using the private key
KEY.PRIV(keys.private)
# Returns "u8VowWT3lK6IlEmARreueWkGauYwL2zBa5YnLrYWW58="

This can then be passed into a call to JWT.SIGN as a signature for a JWT or JWS.