You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/signing/local-signing.md
+41-39Lines changed: 41 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,32 +21,34 @@ Accessing a private key and certificate directly from the file system is fine du
21
21
22
22
## Example
23
23
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).
25
27
26
28
:::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.
28
30
:::
29
31
30
-
### Step 1: Purchase credentials
32
+
### 1. Purchase credentials
31
33
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.
33
35
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.
35
37
36
38
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).
37
39
38
-
### Step 2: Extract the certificate and key
40
+
### 2. Extract credentials
39
41
40
42
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.
41
43
Use the commands below to extract the key and certificate chain. If prompted, enter the password that was used to generate the `.pfx` file.
42
44
43
45
:::tip
44
46
Make sure you are using a recent version of OpenSSL.
45
-
:::tip
47
+
:::
46
48
47
49
#### Troubleshooting errors
48
50
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.
50
52
51
53
For example, the following error message means the `.pfx` was encrypted with an older standard:
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.
67
69
:::
68
70
69
-
#### Extract the certificate chain
71
+
#### Extract certificate chain
70
72
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:
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.
78
84
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:
80
86
81
87
```shell
82
-
openssl x509 -inform PEM -in mycerts.pem -text
88
+
openssl x509 -inform PEM -in mycerts.pub -text
83
89
```
84
90
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.
86
96
87
97
```
88
98
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
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:
108
110
109
111
```json
110
112
"alg": "ps256",
111
113
"private_key": "mykey.pem",
112
-
"sign_cert": "mycerts.pem"
114
+
"sign_cert": "mycerts.pub"
113
115
```
114
116
115
117
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](..
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`.
124
126
125
127
:::warning
126
128
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).
127
129
:::
128
130
129
-
### Confirm it worked
131
+
### 4. Confirm it worked
130
132
131
133
Use C2PA Tool to confirm that you successfully signed the asset. Enter a command like this:
132
134
@@ -139,13 +141,13 @@ This command displays the manifest attached to `signed_image.jpg` and should inc
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...."
0 commit comments