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/crypto-providers/cryptoki.md
+22-20Lines changed: 22 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,7 +110,9 @@ For Cryptoki-based signing, tool setup can be complex. Unlike the KSP/CSP provid
110
110
111
111
If your signing tool does not provide guidance for using Cryptoki libraries, you probably need a solid understanding of the specific tool chain to configure it. For better results, please also refer to [signing flow](/crypto-providers#flow).
112
112
113
-
## OpenSSL {#openssl}
113
+
## Common code signing tools
114
+
115
+
### OpenSSL {#openssl}
114
116
115
117
_[OpenSSL]_ is a toolkit that provides a range of cryptographic operations, including signing.
116
118
@@ -119,9 +121,9 @@ _[OpenSSL]_ is a toolkit that provides a range of cryptographic operations, incl
119
121
>
120
122
> Only latest OpenSSL 1.1 and 3.x versions are supported. For Linux, see also the notes in [supported Linux distributions](#supported-linux-distributions).
121
123
122
-
### Setup {#openssl-setup}
124
+
#### Setup {#openssl-setup}
123
125
124
-
#### Install the `libp11` OpenSSL engine
126
+
##### Install the `libp11` OpenSSL engine
125
127
126
128
_OpenSSL_ cannot directly communicate with a Cryptoki library. Instead, the [OpenSC pkcs11 OpenSSL engine (`libp11`)](https://github.com/OpenSC/libp11) can be used as adapter between OpenSSL and the SignPath Cryptoki library.
127
129
@@ -132,7 +134,7 @@ _OpenSSL_ cannot directly communicate with a Cryptoki library. Instead, the [Ope
132
134
133
135
**Linux:** Install the OpenSC pkcs11 engine via your package manager (e.g. `apt-get install libengine-pkcs11-openssl` on Debian-based or `dnf install openssl-pkcs11` on RedHat-based distros).
#### Alternative OpenSSL configuration via `OPENSSL_CONF`
165
+
##### Alternative OpenSSL configuration via `OPENSSL_CONF`
164
166
165
167
An _alternative_ to using the `OPENSSL_ENGINES`/`PKCS11_MODULE_PATH` env variables is to use create a `openssl-signpath.cnf` file as follows and set the `OPENSSL_CONF` env to point to the configuration file.
166
168
@@ -182,7 +184,7 @@ init = 0
182
184
PIN = CONFIG
183
185
~~~
184
186
185
-
### Invocation {#openssl-invocation}
187
+
#### Invocation {#openssl-invocation}
186
188
187
189
_OpenSSL_ provides a variety of commands that can be used for signing. In this section, a few of them are outlined.
188
190
@@ -205,7 +207,7 @@ Generally, all commands require the following parameters to work with the SignPa
205
207
|`-inkey`|`pkcs11:id=$ProjectSlug/$SigningPolicySlug;type=private;pin-value=CONFIG`| A PKCS #11 URI including _Project_ and _Signing Policy_ slug, see also [Cryptoki parameters](#cryptoki-parameters).
206
208
{: .break-column-2 }
207
209
208
-
#### openssl dgst
210
+
##### openssl dgst
209
211
210
212
The _[dgst][openssl-dsgt]_ command calculates digests of files, but can also be used to create and verify signatures.
The _[cms][openssl-cms]_ command can be used to create embedded S/MIME or detached PEM/DER signatures. It uses the Cryptographic Message Syntax format (CMS, formerly known as PKCS#7).
251
253
@@ -261,7 +263,7 @@ Sample: sign the file `artifact.bin` using `certificate.pem`, write the detached
_[osslsigncode]_ is a tool that allows applying Windows Authenticode signatures on Linux systems using OpenSSL. Accordingly, it also requires an OpenSC pkcs11 OpenSSL engine installation. See the [OpenSSL](#openssl) section for details.
267
269
@@ -270,15 +272,15 @@ _[osslsigncode]_ is a tool that allows applying Windows Authenticode signatures
270
272
>
271
273
> Only osslsigncode 2.x or higher is supported. Also see the notes in [supported Linux distributions](#supported-linux-distributions) regarding the supported OpenSSL versions.
272
274
273
-
### Setup {#osslsigncode-setup}
275
+
#### Setup {#osslsigncode-setup}
274
276
275
277
`osslsigncode` requires the X.509 certificate corresponding to the SignPath Project and Signing Policy to be downloaded from SignPath and converted to _PEM format_. You can convert the certificate using OpenSSL via the following example.
276
278
277
279
~~~ powershell
278
280
openssl x509 -inform DER -in "certificate.cer" -outform PEM -out "certificate.pem"
The [OpenSC](https://github.com/OpenSC/OpenSC) [`pkcs11-tool`](https://linux.die.net/man/1/pkcs11-tool) utility can be used to troubleshoot PKCS #11 modules (e.g. listing all available objects or supported algorithms) but also can be used to read certificates/public keys and to perform signing operations.
309
311
310
-
### Setup {#opensc-pkcs11-tool-setup}
312
+
#### Setup {#opensc-pkcs11-tool-setup}
311
313
312
314
{:.panel.info}
313
315
>**`pkcs11-tool` before version 0.23**
@@ -316,7 +318,7 @@ The [OpenSC](https://github.com/OpenSC/OpenSC) [`pkcs11-tool`](https://linux.die
316
318
>
317
319
> _Background: `pkcs11-tool` used to open the Cryptoki session in a read/write mode (see [GitHub issue #2182](https://github.com/OpenSC/OpenSC/issues/2182)) and therefore fails with `PKCS11 function C_OpenSession failed: rv = CKR_TOKEN_WRITE_PROTECTED`. This flag enables compatibility with these earlier versions._
318
320
319
-
### Invocation {#opensc-pkcs11-tool-invocation}
321
+
#### Invocation {#opensc-pkcs11-tool-invocation}
320
322
321
323
{:.panel.tip}
322
324
>**Tip**
@@ -328,7 +330,7 @@ The [OpenSC](https://github.com/OpenSC/OpenSC) [`pkcs11-tool`](https://linux.die
|`--module`|`/path/to/libSignPath.Cryptoki.so`| Path to the SignPath Cryptoki library
340
342
|`--pin`|`CONFIG` or `$OrganizationId:$ApiToken`| See [PIN parameter](#cryptoki-parameters)
341
343
342
-
#### Listing available PKCS #11 objects
344
+
##### Listing available PKCS #11 objects
343
345
344
346
The following command lists available objects, which corresponds to the list of signing policies for which the authenticated user has _Submitter_ permissions.
|`--label`|`$ProjectSlug/$SigningPolicySlug`| _Project_ and _Signing Policy_ slugs, separated by a forward slash
365
367
|`--input-file`|`/path/to/hash.bin`| File containing a hashin _binary_ form
366
368
367
-
## Java jarsigner {#jarsigner}
369
+
### Java jarsigner {#jarsigner}
368
370
369
371
The [`jarsigner`](https://docs.oracle.com/en/java/javase/17/docs/specs/man/jarsigner.html) command signs and verifies Java archives (e.g. JAR, WAR, EAR). It is included with the Java Development Kit (JDK).
370
372
371
-
### Setup {#jarsigner-setup}
373
+
#### Setup {#jarsigner-setup}
372
374
373
375
1. Configure the SunPKCS11 Provider
374
376
* OpenJDK: the provider is configured automatically
Copy file name to clipboardExpand all lines: docs/crypto-providers/gpg.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ description: Creating GPG signatures with SignPath
10
10
11
11
[GNU Privacy Guard](https://gnupg.org/), also known as GPG or GnuPG, is an Open Source implementation of the OpenPGP standard. This section provides information about using GPG with SignPath, as well as some code signing tools that build on GPG.
12
12
13
-
## Terminology
13
+
###Terminology
14
14
15
15
GPG uses various terms for certificates. We use the term **_GPG key_** in our GPG documentation, but keep in mind that other parts of the SignPath documentation will use the general term _certificate_. See [Managing Certificates](/managing-certificates#certificate-types) for more information.
16
16
@@ -49,6 +49,8 @@ See [SignPath Crypto Providers](/crypto-providers/#crypto-provider-configuration
49
49
50
50
## Signing code with GPG
51
51
52
+
### Common signing tools
53
+
52
54
The [Linux samples] contain complete example scripts (including all preparation steps) to sign and verify files using the following formats and tools:
53
55
54
56
| Format | Signing invocation | Sample script | Note
This section provides information to use SignPath with any tool that supports macOS CryptoTokenKit.
12
12
@@ -22,13 +22,13 @@ Simply copy-deploy the `SignPathCryptoTokenKit.app` application to the target sy
22
22
23
23
See [SignPath Crypto Providers](/crypto-providers/#crypto-provider-configuration) for general configuration options.
24
24
25
-
### Background
25
+
##Usage
26
26
27
-
macOS allows CryptoTokenKit extensions to be registered in the system. Through these extensions, key material and certificates can be provided. An extension is only available while the application that provides the extension is running. Therefore, before calling signing tools like `codesign`, the `SignPathCryptoTokenKit.app` needs to be started.
27
+
### General usage
28
28
29
-
###Usage
29
+
#### Enable the CryptoTokenKit extension
30
30
31
-
The `SignPathCryptoTokenKit.app` application loads all available certificates for the given parameters and makes them avaialble in the macOS keychain through a CryptoTokenKit extension. The application supports the following parameters (all of them are optional):
31
+
Start the `SignPathCryptoTokenKit.app` application to load certificates into the macOS keychain through a CryptoTokenKit extension. The application supports the following parameters (all optional):
> SignPath uses the CryptoTokenKit extension mechanism to provide keys and certificates can be provided. The application that registers the extension must be running. Therefore, before calling signing tools like `codesign`, the `SignPathCryptoTokenKit.app` needs to be started.
56
+
52
57
#### Project and signing policy {#usage-project-signing-policy}
53
58
54
59
Identify a specific _Signing Policy_ by specifying _Project_ and _Signing Policy_ slugs. The SignPath CryptoTokenKit provider will select that policy's certificate.
@@ -62,48 +67,7 @@ Default values can be provided as [configuration values](index#crypto-provider-c
62
67
>
63
68
> This works fine if a certificate clearly identifies a single Signing Policy. However, if a certificate is referenced by more than one available _Signing Policy_, using it will result in an ambiguous reference error.
64
69
65
-
### Troubleshooting
66
-
67
-
Loading the certificates and making them available in the macOS keychain can take up to 20 seconds.
68
-
69
-
#### Logs
70
-
71
-
Unless specified otherwise, the log files are stored in `~/Library/Logs/SignPathCryptoTokenKit/` and `~/Library/Containers/io.signpath.apps.CryptoTokenKit/Data/Library/Logs/ctk/` respectively.
72
-
73
-
#### Useful commands:
74
-
75
-
The following commands are helpful to make sure the setup is correct:
76
-
77
-
Using the `security` command, the registered smart cards can be listed. This list should contain an entry `io.signpath.apps.SignPathCryptoTokenKit.ctk:<identifier>`
78
-
~~~bash
79
-
security list-smartcard
80
-
~~~
81
-
82
-
Using the `pluginkit` tool, the registration of the token driver can be verified. The command lists all registered tokens and should also list `io.signpath.apps.CryptoTokenKit($Version)`.
83
-
84
-
~~~bash
85
-
pluginkit -m -v -p com.apple.ctk-tokens
86
-
~~~
87
-
88
-
The smartcard service on macOS sometimes has issues. If the certificates cannot be loaded, the service can be restarted by running the following command:
89
-
90
-
~~~bash
91
-
killall ctkd
92
-
~~~
93
-
94
-
{:.panel.info}
95
-
> **Info: Updated intermediate certificate**
96
-
>
97
-
> When creating a certificate in the Apple Developer portal, the intermediate certificate can be selected. On some machines, the new intermediate certificate is still missing. You can download it [here](https://www.apple.com/certificateauthority/DeveloperIDG2CA.cer).
98
-
99
-
{:.panel.warning}
100
-
> **Warning: Produce correct timestamps**
101
-
>
102
-
> When using codesign (or any other signing tool) directly, you are responsible for correct time stamping. See [Timestamps](/crypto-providers#timestamps)
> `productsign` requires an "Apple Developer Installer" certificate.
111
+
112
+
## Troubleshooting
113
+
114
+
Loading the certificates and making them available in the macOS keychain can take up to 20 seconds.
115
+
116
+
### Logs
117
+
118
+
Unless specified otherwise, the log files are stored in `~/Library/Logs/SignPathCryptoTokenKit/` and `~/Library/Containers/io.signpath.apps.CryptoTokenKit/Data/Library/Logs/ctk/` respectively.
119
+
120
+
### Useful commands
121
+
122
+
The following commands are helpful to make sure the setup is correct:
123
+
124
+
Using the `security` command, the registered smart cards can be listed. This list should contain an entry `io.signpath.apps.SignPathCryptoTokenKit.ctk:<identifier>`
125
+
~~~bash
126
+
security list-smartcard
127
+
~~~
128
+
129
+
Using the `pluginkit` tool, the registration of the token driver can be verified. The command lists all registered tokens and should also list `io.signpath.apps.CryptoTokenKit($Version)`.
130
+
131
+
~~~bash
132
+
pluginkit -m -v -p com.apple.ctk-tokens
133
+
~~~
134
+
135
+
The smartcard service on macOS sometimes has issues. If the certificates cannot be loaded, the service can be restarted by running the following command:
136
+
137
+
~~~bash
138
+
killall ctkd
139
+
~~~
140
+
141
+
{:.panel.info}
142
+
> **Info: Updated intermediate certificate**
143
+
>
144
+
> When creating a certificate in the Apple Developer portal, the intermediate certificate can be selected. On some machines, the new intermediate certificate is still missing. You can download it [here](https://www.apple.com/certificateauthority/DeveloperIDG2CA.cer).
145
+
146
+
{:.panel.warning}
147
+
> **Warning: Produce correct timestamps**
148
+
>
149
+
> When using codesign (or any other signing tool) directly, you are responsible for correct time stamping. See [Timestamps](/crypto-providers#timestamps)
Use `GET {{site.sp_api_url}}/v1/$OrganizationId/Cryptoki/MySigningPolicies?``projectSlug=$Project&signingPolicySlug=$SigningPolicy` to get information about the signing plicy, including the X.509 certificate and RSA key parameters.
87
+
Use `GET {{site.sp_api_url}}/v1/$OrganizationId/Cryptoki/MySigningPolicies?``projectSlug=$Project&signingPolicySlug=$SigningPolicy` to get information about the signing policy, including the X.509 certificate and RSA key parameters.
88
88
89
89
(If project and signing policy are not specified, this API returns all signing policies where user identified by the API token is assigned as _Submitter_.)
0 commit comments