sign Command¶
Signs a file using specific algorithm and formatting options. The signature can either be attached or detached:
- Attached: the signature and payload (content) are contained in the same output file.
- Detached: the signature is output to a separate file, which will not contain the payload.
The resultant signed output will be a CBOR-encoded file.
Info
Currently, the sign command only supports CBOR-encoded types on the RIM types page.
Usage¶
rim sign -r <string> -i <file> -k <file> -o <file> [-p <file>] [-a <string>] [-d <payload-file>] [-e] [-pk <hex>] [-uk <hex>]
Parameters¶
| Parameter | Description | Required | Type |
|---|---|---|---|
-r, --rim-type |
Specifies the RIM type. | Yes | String |
-i, --in |
Specifies the input file to sign. | Yes | File |
-k, --private-key-file |
The private key used to sign the specified file. | Yes | File |
-p, --public-certificate |
The public key certificate to be used during the signing process. | Yes1 | File |
-a, --algorithm |
Signing algorithm used when no certificate or JSON Web Key supplies one; supplied credentials take precedence.2 | No | String |
-d, --detached |
Produces a COSE signature envelope with no payload; supply the input payload path here. | No | File |
-e, --embed-cert |
Embeds a certificate, depending on output type.3 | No | |
-pk, --protected-kid |
A hexadecimal string that represents the key identifier to place in the COSE protected header.4 | No | String |
-uk, --unprotected-kid |
A hexadecimal string that represents the key identifier to place in the COSE unprotected header.4 | No | String |
-o, --out |
The path of the file to write the signed file to. | Yes | File |
For detached signing, retain the input payload and pass it to verify with -d.
Examples¶
Before Starting
Before running these examples, please ensure that you change into the data directory (requires installation):
Sign an unsigned CoSWID tag:
Sign an unsigned CoRIM:
-
Required for CoRIMs. For CoSWIDs, omit the certificate with a JSON Web Key containing
algandkid, or with-aplus-pk/-ukfor a PEM key. ↩ -
Must be an IANA-registered COSE algorithm . ↩
-
For COSE : the provided certificate and its thumbprint are embedded into the protected header. ↩
-
Used for CoSWID COSE headers. If both are supplied, the protected KID takes precedence. ↩↩