Skip to content

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):

cd /opt/rimtool/data

Sign an unsigned CoSWID tag:

rim sign -r coswid --in coswid/coswid_rim_1.coswid -k keys/COMP_OEM1_rim_signer_ecc_512_sha384.key -p certs/COMP_OEM1_rim_signer_ecc_512_sha384.pem --out ~/coswid_rim_1.signed.coswid.cose

Sign an unsigned CoRIM:

rim sign -r corim_comid --in corim/corim_1.corim.cose -k keys/COMP_OEM1_rim_signer_ecc_512_sha384.key -p certs/COMP_OEM1_rim_signer_ecc_512_sha384.pem --out ~/corim_1.signed.corim.cose

  1. Required for CoRIMs. For CoSWIDs, omit the certificate with a JSON Web Key containing alg and kid, or with -a plus -pk/-uk for a PEM key. ↩

  2. Must be an IANA-registered COSE algorithm . ↩

  3. For COSE : the provided certificate and its thumbprint are embedded into the protected header. ↩

  4. Used for CoSWID COSE headers. If both are supplied, the protected KID takes precedence. ↩↩