| 1 |
Proton SSL/TLS implementations have platform dependent formats for specifying |
| 2 |
private and public key information. |
| 3 |
|
| 4 |
OpenSSL |
| 5 |
======= |
| 6 |
|
| 7 |
On OpenSSL (POSIX) based systems, certificates and their private keys are |
| 8 |
specified separately in two files: the public X509 certificate in PEM format |
| 9 |
and the password protected PKCS#8 encoded private key. |
| 10 |
|
| 11 |
`pn_ssl_domain_set_credentials(path_to_public_x509.pem, |
| 12 |
path_to_private_pkcs8.pem, password_for_pkcs8)` |
| 13 |
|
| 14 |
|
| 15 |
A database of trusted Certificate Authority certificates may be specified as a |
| 16 |
path to a file or a directory. In the former case, the file consists of one |
| 17 |
or more X509 certificates in PEM format concatenated together. In the latter |
| 18 |
case, the directory contains a file for each X509 certificate in PEM format |
| 19 |
and indexed by (i.e. the file name is derived from) the X509 `-subject_hash` |
| 20 |
of the certificate's name. See |
| 21 |
[here](https://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.htm) |
| 22 |
for more details. |
| 23 |
|
| 24 |
|
| 25 |
SChannel |
| 26 |
======== |
| 27 |
|
| 28 |
On SChannel (Windows) based systems, trust and identity certificates are |
| 29 |
stored in certificate stores, which may be file based or system/registry |
| 30 |
based. The former are in PKCS#12 format and the latter are typically managed |
| 31 |
by the Microsoft graphical management console. The public and private keys |
| 32 |
are stored together, except in the case of trusted authority certificates |
| 33 |
which only contain the public key information. |
| 34 |
|
| 35 |
To specify a certificate: |
| 36 |
|
| 37 |
`pn_ssl_domain_set_credentials(store, certificate_friendly_name, |
| 38 |
password_for_store)` |
| 39 |
|
| 40 |
File based stores are specified by their relative or absolute path names. |
| 41 |
Registry stores are specified by their names (which are case insensitive) |
| 42 |
preceded by "ss:" for "Current User" system stores or "lmss:" for "Local |
| 43 |
Machine" system stores. Examples: |
| 44 |
|
| 45 |
"ss:Personal" specifies the Personal store for the Current User. |
| 46 |
|
| 47 |
"lmss:AMQP" specifies a registry store called "AMQP" for the Local Machine |
| 48 |
context. |
| 49 |
|
| 50 |
"ss:Root" specifies the Trusted Root Certificate Authorities store for the |
| 51 |
Current User. |
| 52 |
|
| 53 |
If a store contains a single certificate, the friendly name is optional. The |
| 54 |
password may be null in the case of a registry store that is not password |
| 55 |
protected. |
| 56 |
|
| 57 |
Trusted root certificates must be placed in a store that is not password |
| 58 |
protected. |
| 59 |
|
| 60 |
In the special case that the peer certificate chain being verified requires |
| 61 |
revocation checking, the trusted root certificate must be present in both the |
| 62 |
trust store specified to Proton and also in the Windows "Trusted Root |
| 63 |
Certificate Authorities" system store. Such certificate chains are usually |
| 64 |
managed by a central corporate network administrator or by a recognized |
| 65 |
certificate authority in which case the trusted root is often already present |
| 66 |
in the system store. This requirement can be worked around by creating a |
| 67 |
special purpose CA database for Proton that includes the target peer's |
| 68 |
certificate (making it trusted, with the caution that you must consider the |
| 69 |
security implications of bypassing the revocation check). |
| 70 |
|
| 71 |
Existing OpenSSL keys (say `xx_x509.pem` and `xx_private_key.pem`) can be |
| 72 |
converted to PKCS#12 by the command: |
| 73 |
|
| 74 |
`openssl pkcs12 -export -out xx_windows.p12 -passin pass:password \ |
| 75 |
-passout pass:password -inkey xx_private_key.pem -in xx_x509.pem \ |
| 76 |
-name xx_friendlyname` |
| 77 |
|
| 78 |
To create a PKCS#12 trust store from a Certificate Authority's public X509 |
| 79 |
certificate with an empty password: |
| 80 |
|
| 81 |
`openssl pkcs12 -export -out trust_store.p12 -in ca-certificate.pem \ |
| 82 |
-name ca-certificate -nokeys -passout pass:` |