Skip to content

Commit 55973b7

Browse files
committed
Input from Maurice, general clarifications
1 parent 593ce06 commit 55973b7

File tree

1 file changed

+41
-39
lines changed

1 file changed

+41
-39
lines changed

docs/signing/local-signing.md

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,34 @@ Accessing a private key and certificate directly from the file system is fine du
2121

2222
## Example
2323

24-
Here is an example of generating a C2PA-compliant set of credentials using [GlobalSign](http://globalsign.com/) certificate authority (CA). GlobalSign is just one of many CAs. For a list of some others, see [Getting a security certificate](get-cert.md#certificate-authorities-cas).
24+
[Getting a certificate](get-cert.md) provides a general overview of getting a signing certificate from a certificate authority (CA).
25+
26+
Here is an example of getting signing credentials using [GlobalSign](http://globalsign.com/) certificate authority (CA) and then using them with C2PA Tool. GlobalSign is just one of many CAs. For a list of some others, see [Getting a security certificate](get-cert.md#certificate-authorities-cas).
2527

2628
:::note
27-
This example uses an inexpensive personal certificate, which is fine for development and testing, but for production use an enterprise certificate is strongly recommended. An enterprise certificate is required for [Verify](https://verify.contentauthenticity.org/) to display your organization name when for signed assets.
29+
This example uses an inexpensive personal certificate, which is fine for development and testing, but in production, an enterprise certificate is strongly recommended. An enterprise certificate is required for [Verify](https://verify.contentauthenticity.org/) to display your organization name when for signed assets.
2830
:::
2931

30-
### Step 1: Purchase credentials
32+
### 1. Purchase credentials
3133

32-
This example uses a [PersonSign1](https://shop.globalsign.com/en/secure-email) certificate from GlobalSign that contains KU and EKU values required to sign C2PA manifests.
34+
The following is an example of using a [PersonSign1](https://shop.globalsign.com/en/secure-email) certificate from GlobalSign that contains KU and EKU values required to sign C2PA manifests.
3335

34-
Follow the instructions to purchase and download your `.pfx` file. This file is a PKCS12 container that holds your certificate chain and private signing key. Other certificate providers may have alternate ways of providing your private key and certificate and may include only the end-entity certificate and so you must manually download the rest of the certificate chain.
36+
Follow the CA's instructions to purchase and download your `.pfx` file. This file is a PKCS12 container that holds your certificate chain and private signing key. Other certificate providers may have alternate ways of providing your private key and certificate and may include only the end-entity certificate and so you must manually download the rest of the certificate chain.
3537

3638
The rest of this tutorial uses OpenSSL (a set of cryptographic utilities). If OpenSSL is not installed on your system, see [OpenSSL](https://www.openssl.org/source/) for the source distribution or the [list of unofficial binary distributions](https://wiki.openssl.org/index.php/Binaries).
3739

38-
### Step 2: Extract the certificate and key
40+
### 2. Extract credentials
3941

4042
To work with the certificate, you need to extract it. When the CAI SDK adds Content Credentials to an asset, it incorporates the certificate (including the associated public key) into the manifest.
4143
Use the commands below to extract the key and certificate chain. If prompted, enter the password that was used to generate the `.pfx` file.
4244

4345
:::tip
4446
Make sure you are using a recent version of OpenSSL.
45-
:::tip
47+
:::
4648

4749
#### Troubleshooting errors
4850

49-
In this step, OpenSSL may report errors when extracting the key or certificate chain. In many cases, if OpenSSL generates the output file, you can ignore the messages. However, in some cases you may need to add `-legacy` to the command for it to work properly.
51+
In this step, OpenSSL may report errors when extracting the key or certificate chain. In many cases, if OpenSSL generates the output file, you can ignore the messages.
5052

5153
For example, the following error message means the `.pfx` was encrypted with an older standard:
5254

@@ -66,50 +68,50 @@ openssl pkcs12 -in mycertfile.pfx -nocerts -out mykey.pem -nodes
6668
Check to make sure the above command generated a `.pem` file and it's not an empty file. For more information, see [Troubleshooting errors](#troubleshooting-errors) above.
6769
:::
6870

69-
#### Extract the certificate chain
71+
#### Extract certificate chain
7072

71-
For many certificate providers, the `.pfx` file contains not just your certificate but the complete certificate trust chain. When the `.pfx` file does not contain the certificate chain, you can obtain it from your provider.
73+
For many certificate providers, the `.pfx` file contains not just your certificate but the complete certificate trust chain, which you can extract with a command like this:
7274

7375
```shell
74-
openssl pkcs12 -in mycertfile.pfx -nokeys -out mycerts.pem
76+
openssl pkcs12 -in mycertfile.pfx -nokeys -out mycerts.pub
7577
```
7678

77-
### Step 3: Use credentials with C2PA Tool
79+
When the `.pfx` file does not contain the certificate chain, you can obtain it from your provider.
80+
81+
### 3. Determine signature algorithm
82+
83+
To use the credentials extracted above you must know the signature types they support. Typically, you'll already know this information or the certificate provider will provide it.
7884

79-
To use the credentials extracted above you must know the signature types they support. Typically, the certificate provider will provide this information. If it is not, enter this OpenSSL command to dump certificate information:
85+
You can also enter this OpenSSL command to dump information about the public key used with the certificate:
8086

8187
```shell
82-
openssl x509 -inform PEM -in mycerts.pem -text
88+
openssl x509 -inform PEM -in mycerts.pub -text
8389
```
8490

85-
This command produces a text summary of the certificate properties, as shown in the example below. Look for a line containing `Signature Algorithm`. See the table above to determine the corresponding signature type. For this example with a certificate issued by GlobalSign, `Signature Algorithm: sha256WithRSAEncryption` corresponds to the PS256 signature type.
91+
Where `mycerts.pub` is the file containing the certificate chain from signing certificate to the last certificate before the root CA, concatenated.
92+
93+
This command produces a text summary of the certificate properties, as shown in the example below. Look for a line containing `Signature Algorithm`. The public key indicates the signature algorithm used. See the table in [Getting a certificate](get-cert.md#signature-types) to determine the corresponding signature type.
94+
95+
For this example with a certificate issued by GlobalSign, `Signature Algorithm: sha256WithRSAEncryption` corresponds to the PS256 signature type.
8696

8797
```
8898
Certificate:
89-
Data:
90-
Version: 3 (0x2)
91-
Serial Number:
92-
73:0d:01:c3:04:06:62:e4:60:0a:0b:0c
93-
Signature Algorithm: sha256WithRSAEncryption
94-
Issuer: C = BE, O = GlobalSign nv-sa, CN = GlobalSign GCC R3 PersonalSign 1 CA 2020
95-
Validity
96-
Not Before: Oct 13 13:33:02 2022 GMT
97-
Not After : Oct 14 13:33:02 2023 GMT
98-
Subject: CN = [email protected], emailAddress = [email protected]
99-
Subject Public Key Info:
100-
Public Key Algorithm: rsaEncryption
101-
Public-Key: (2048 bit)
102-
.
103-
.
104-
.
99+
Data:
100+
Version: 3 (0x2)
101+
Serial Number:
102+
74:72:be:13:0c:8f:bf:c4:81:56:f7:5f:35:24:0e:9a:9b:8e:9b:5b
103+
Signature Algorithm: sha256WithRSAEncryption
104+
...
105105
```
106106

107+
### 4. Test with C2PA Tool
108+
107109
You now have all the needed information to configure C2PA Tool for manifest signing. Edit your [manifest store file](../c2patool/docs/manifest.md) to add the following fields that are specific to C2PA Tool:
108110

109111
```json
110112
"alg": "ps256",
111113
"private_key": "mykey.pem",
112-
"sign_cert": "mycerts.pem"
114+
"sign_cert": "mycerts.pub"
113115
```
114116

115117
The `private_key` and `sign_cert` properties must be full paths to the key and certificate chain files generated above.
@@ -120,13 +122,13 @@ You can now use C2PA Tool [to add a manifest to an image or other asset file](..
120122
c2patool -m my_manifest.json -o signed_image.jpg my_image.jpg
121123
```
122124

123-
The example above uses the information in `my_manifest.json` to add a new manifest to output `signed_image.jpg` using source `my_image.jpg`. The manifest will be signed using the PS256 signature algorithm with private key `mykey.pem`. The manifest will contain the trust chain specified in `mycerts.pem`.
125+
The example above uses the information in `my_manifest.json` to add a new manifest to output `signed_image.jpg` using source `my_image.jpg`. The manifest will be signed using the PS256 signature algorithm with private key `mykey.pem`. The manifest will contain the trust chain specified in `mycerts.pub`.
124126

125127
:::warning
126128
This example accesses the private key and certificate directly from the file system, which is fine during development, but is not secure for production use. For more information, see [Using a certificate in production](prod-cert.mdx).
127129
:::
128130

129-
### Confirm it worked
131+
### 4. Confirm it worked
130132

131133
Use C2PA Tool to confirm that you successfully signed the asset. Enter a command like this:
132134

@@ -139,13 +141,13 @@ This command displays the manifest attached to `signed_image.jpg` and should inc
139141
```json
140142
...
141143
"signature_info": {
142-
"cert_serial_number": "012345678901234567890123456789",
143-
"time": "2023-11-02T17:18:14+00:00"
144-
},
145-
"label": "urn:uuid:0b9bc2b8-6d66-4258-9fed-694c30abcdef"
144+
"cert_serial_number": "012345678901234567890123456789",
145+
"time": "2023-11-02T17:18:14+00:00"
146+
},
147+
"label": "urn:uuid:0b9bc2b8-6d66-4258-9fed-694c30abcdef"
146148
...
147149
```
148150

149151
:::info
150-
You can also use [Verify](https://contentcredentials.org/verify) to confirm that your image was signed, but if you used a personal certificate (not an organization certificate) then Verify won't show detailed information about the credential used.
152+
You can also use [Verify](https://contentcredentials.org/verify) to confirm that your image was signed, but if you used a personal certificate (not an organization certificate) then [Verify won't show the organization name](get-cert.md#organization-name) and if your certificate is not on the [known certificate list](../trust-list.mdx), Verify [displays the message](../verify.mdx#title-and-signing-information) "The Content Credential issuer couldn't be recognized...."
151153
:::

0 commit comments

Comments
 (0)