KEY.PUB

KEY.PUB validates the format of the public 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.PUB will throw an error. It is designed for use within the Xapix system.

Function category: Key

Syntax

KEY.PUB(arg1)

Arguments

Description

arg1

Public key of a public/private key pair.

Example

Let's say we have the following private key.

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

If we wanted to verify a token that had been signed with the private counterpart to the key above, we could validate and prepare the public token using the following function.

# Validate and prepare public token
KEY.PUB(keys.public)
# Returns "V2ugDNbl8w4xejVCloUtiTwctAP9AO6lDkHkFPoFWtw="

This can then be passed into a call to JWT.VERIFY or JWT.EXTRACT to verify or extract a JWT or JWS.