Signing for approval
This article covers:
- Basics on how to sign & approve requests in Taurus-PROTECT.
- How signatures are used to ensure authenticity of approvals.
- The importance of private keys and keeping them secure.
- How to programmatically sign a request.
Introduction
Many actions within Taurus-PROTECT are subject to governance rules that require digital signatures from designated operators in groups. Therefore, it is critical to ensure that every approval is genuine, traceable, and tamper-proof.
A digital signature allows an approver to sign a request in a way that:
- Verifies the identity of the signer.
- Guarantees the integrity of the signed data.
- Prevents the signer from denying their approval (non-repudiation).
This document explains how Taurus-PROTECT utilizes digital signatures for approvals, how those signatures are used to confirm authenticity, and how to create and manage signature keys. It also contains examples on how to programmatically sign a request.
🔐 User key management
Public and private keys can be assigned to users using the Taurus UI. For more information, please see the relevant section in the User Guide .
When is a signature required?
Several of Taurus Protect APIs include a signature parameter. The most important ones are the following:
Approving a transaction request
Approving a whitelisted contract
Approving a whitelisted address
What do I need to digitally sign a request?
Warning
A Taurus-PROTECT user can have exactly one signing method enabled. The following table lists the available, mutually exclusive signing methods. Please ensure this is understood prior to changing the public key field for a user.
The remainder of this document will discuss signing via API. Please note that the user you are setting up for programatic signatures, will no longer be able to sign requests any other way.
- Secure access to an unencrypted ECDSA private key which is set up for the API user as described in the User Guide
- You must have the correct roles assigned to your API user. These roles are enforced for each API call, such as
RequestApprover,WhitelistedAddressApprover, etc. You can read more about roles in the User Management section in our guides. - A user that is a member of the respective signature group based on the transaction rules configured in Protect. For more information on this, see Transaction Rulesin our guides.
🔑 Roles
The roles required are listed in the API documentation on each approval endpoint. If you do not have the right permissions, you will need to contact your administrator.
Generate a new key
To generate a key-pair that you can use to sign transactions programmatically, we recommend using the commonly available openssl tool.
First, you need to generate an ECDSA private key on the P256 NIST curve:
Next, you must derive the corresponding public key from the private key:
Configure your user
A Protect Administrator will need to set or change thePublic Keyentry for the API user account and ensure the user is assigned to the correct approval group. Finally, another Administrator and one or more Superadmins must approve the account’s group memberships and the new public key.
🔑 Keep your private key secure
For production workloads, we recommend storing your private key in a secret manager such as Vault, or KMS. Avoid storing unencrypted private keys in version control systems!
Signing Requests programmatically
Prepare the payload
Before applying the signature, we must prepare the payload to be signed.
A single signature can be applied to multiple requests of the same kind, as each request kind will have its own numeric IDs that can overlap. To retrieve the necessary information for producing the signatures, you can use eg. the following endpoints:
- List whitelisted addresses for approval
- List whitelisted contracts for approval
- List requests for approval
These endpoints return with the same pattern in their responses. To produce a valid signature, we require 2 pieces of data from the response JSON structure: the id of the item and the metadata.hash property.
Always validate prior to signing
While this document is focusing on producing a correct signature that’s accepted by Taurus-PROTECT, for brevity we omit important steps to verify the data we sign.
For production workloads, ensure you validate and verify the contents of what is being signed and ensure it is correct.
Now that all necessary data is retrieved, 2 different structures must be prepared for a successful signature of requests:
- The numerically sorted list of IDs that are being signed off on
- The list of
metadata.hashvalues for each request, numerically sorted by the corresponding IDs.
Creating the ECDSA-SHA256 signature
Using the ECDSA-SHA256 signature scheme to produce a signature in the format Taurus-PROTECT expects requires the following steps:
- Signing the sorted hashes list using the ECDSA private key and SHA256 hash function.
- Base64 encoding the binary signature.
To illustrate this in a more concrete example, we will be using code from the Taurus Java SDK (we use helper classes that are stripped down versions of the SDK with randomly generated instance variables values).
Java signing example
As an alternative to the openssl based commands in the Generate a new key section above you can use the ECDSA class from the Java code above to create a new key pair and use the code snippet below to convert the public key to a PEM format compatible with the Taurus-PROTECT UI:
Code Examples
Taurus customer support is able to provide more full fledged code examples upon request. The snippets above are intended for demonstration only. They are not complete and will not work on their own without additional library imports and supporting code.
Submitting the signature
After creating a request and listing pending items for approval, submitting the approval and the corresponding signature also has its own endpoint for each kind of request you can make:
Approvals all use the same JSON schema for the POST request:
At this point, all data should be available for creating the API call:
- Comment is a free-form field, and typically you will want to use some internal reference or verifiable information that corresponds to the approval
- We prepared the
idssorted list in the “Prepare the Payload” section above. - The
signaturefield is the Base64 encoded signature created in the previous section.
Congratulations! You have successfully approved some requests in Taurus-PROTECT!
Complete examples
To see some complete workflow examples, please see the following pages:
- Whitelisting: How to whitelist addresses and contracts
- Transactions: How to create a transaction