How to Get a Certificate
This document describes how to get a certificate to enroll in ScalarDL.
ScalarDL has several kinds of authentication methods. If you use digital-signature
as the authentication method, you must prepare private key and certificate files. For more details on authentication methods, see ScalarDL Authentication Guide.
Private key and certificate requirements​
If you use digital-signature
as the authentication method, you must create a private key and certificate that satisfy the following requirements:
SEC1
orPKCS#8
keyECDSA
as the algorithmP-256
as the curve parameterSHA256
as the hash function
ScalarDL does not check the expiration date of certificates. So, you can set any expiration dates to certificates that ScalarDL uses.
Create a private key and certificate file​
- Self-signed
- CFSSL server
- Third-party CA or Private CA
You can create a self-signed certificate as follows:
This example creates a SEC1
key.
- CFSSL
- OpenSSL
Prerequisites
You must install the cfssl and cfssljson command-line tools for the following steps.
Create a local CA
-
Create a working directory.
mkdir -p ${HOME}/scalardl/digital-signature/certs/
-
Change the working directory to
${HOME}/scalardl/digital-signature/certs/
.cd ${HOME}/scalardl/digital-signature/certs/
-
Create a JSON file that includes CA information.
cat << 'EOF' > ${HOME}/scalardl/digital-signature/certs/ca.json
{
"CN": "scalardl-example-ca",
"key": {
"algo": "ecdsa",
"size": 256
},
"names": [
{
"C": "JP",
"ST": "Tokyo",
"L": "Shinjuku",
"O": "ScalarDL Example CA"
}
]
}
EOF -
Create the CA private key and certificate files.
cfssl gencert -initca ca.json | cfssljson -bare ca
-
Create a JSON file that includes CA configurations.
cat << 'EOF' > ${HOME}/scalardl/digital-signature/certs/ca-config.json
{
"signing": {
"default": {
"expiry": "87600h"
},
"profiles": {
"scalardl-example-ca": {
"expiry": "87600h",
"usages": [
"signing",
"key encipherment",
"server auth"
]
}
}
}
}
EOF
Create a private key and certificate for each component
- ScalarDL Ledger
- ScalarDL Auditor
- Client
-
Create a JSON file that includes ScalarDL Ledger information.
cat << 'EOF' > ${HOME}/scalardl/digital-signature/certs/ledger.json
{
"CN": "scalardl-ledger",
"hosts": [
"ledger.scalardl.example.com",
"localhost"
],
"key": {
"algo": "ecdsa",
"size": 256
},
"names": [
{
"C": "JP",
"ST": "Tokyo",
"L": "Shinjuku",
"O": "ScalarDL Ledger Example"
}
]
}
EOF -
Create the private key and certificate files for ScalarDL Ledger.
cfssl gencert -ca ca.pem -ca-key ca-key.pem -config ca-config.json -profile scalardl-example-ca ledger.json | cfssljson -bare ledger
-
Confirm that the private key and certificate files were created.
ls -1
You should see the following output:
ca-config.json
ca-key.pem
ca.csr
ca.json
ca.pem
ledger-key.pem
ledger.csr
ledger.json
ledger.pemIn this case:
ledger-key.pem
is the private key file for ScalarDL Ledger.ledger.pem
is the certificate file for ScalarDL Ledger.ca.pem
is the root CA certificate file.
-
Create a JSON file that includes ScalarDL Auditor information.
cat << 'EOF' > ${HOME}/scalardl/digital-signature/certs/auditor.json
{
"CN": "scalardl-auditor",
"hosts": [
"auditor.scalardl.example.com",
"localhost"
],
"key": {
"algo": "ecdsa",
"size": 256
},
"names": [
{
"C": "JP",
"ST": "Tokyo",
"L": "Shinjuku",
"O": "ScalarDL Auditor Example"
}
]
}
EOF -
Create the private key and certificate files for ScalarDL Auditor.
cfssl gencert -ca ca.pem -ca-key ca-key.pem -config ca-config.json -profile scalardl-example-ca auditor.json | cfssljson -bare auditor
-
Confirm that the private key and certificate files were created.
ls -1
You should see the following output:
auditor-key.pem
auditor.csr
auditor.json
auditor.pem
ca-config.json
ca-key.pem
ca.csr
ca.json
ca.pemIn this case:
auditor-key.pem
is the private key file for ScalarDL Auditor.auditor.pem
is the certificate file for ScalarDL Auditor.ca.pem
is the root CA certificate file.
-
Create a JSON file that includes client information.
cat << 'EOF' > ${HOME}/scalardl/digital-signature/certs/client.json
{
"CN": "scalardl-client",
"hosts": [
"client.scalardl.example.com",
"localhost"
],
"key": {
"algo": "ecdsa",
"size": 256
},
"names": [
{
"C": "JP",
"ST": "Tokyo",
"L": "Shinjuku",
"O": "ScalarDL Client Example"
}
]
}
EOF -
Create the private key and certificate files for the client.
cfssl gencert -ca ca.pem -ca-key ca-key.pem -config ca-config.json -profile scalardl-example-ca client.json | cfssljson -bare client
-
Confirm that the private key and certificate files were created.
ls -1
You should see the following output:
ca-config.json
ca-key.pem
ca.csr
ca.json
ca.pem
client-key.pem
client.csr
client.json
client.pemIn this case:
client-key.pem
is the private key file for the client.client.pem
is the certificate file for the client.ca.pem
is the root CA certificate file.
Prerequisites
You must install the openssl
command-line tool for the following steps.
Create a working directory
-
Create a working directory.
mkdir -p ${HOME}/scalardl/digital-signature/certs/
-
Change the working directory to
${HOME}/scalardl/digital-signature/certs/
.cd ${HOME}/scalardl/digital-signature/certs/
Create a private key and certificate for each component
- ScalarDL Ledger
- ScalarDL Auditor
- Client
-
Create an EC parameter.
openssl ecparam -name prime256v1 -out prime256v1.pem
-
Create a private key and CSR.
openssl req -new -newkey ec:prime256v1.pem -nodes -keyout ledger-key.pem -out ledger.csr
-
Convert the
PKCS#8
key to theSEC1
key.openssl ec -in ledger-key.pem -out ledger-key.pem
-
Create a certificate for ScalarDL Ledger.
openssl x509 -req -days 3650 -signkey ledger-key.pem -in ledger.csr -out ledger.pem
-
Confirm that the private key and certificate files were created.
ls -1
You should see the following output:
ledger-key.pem
ledger.csr
ledger.pem
prime256v1.pemIn this case:
ledger-key.pem
is the private key file for ScalarDL Ledger.ledger.pem
is the certificate file for ScalarDL Ledger.
-
Create an EC parameter.
openssl ecparam -name prime256v1 -out prime256v1.pem
-
Create a private key and CSR.
openssl req -new -newkey ec:prime256v1.pem -nodes -keyout auditor-key.pem -out auditor.csr
-
Convert the
PKCS#8
key to theSEC1
key.openssl ec -in auditor-key.pem -out auditor-key.pem
-
Create a certificate for ScalarDL Auditor.
openssl x509 -req -days 3650 -signkey auditor-key.pem -in auditor.csr -out auditor.pem
-
Confirm that the private key and certificate files were created.
ls -1
You should see the following output:
auditor-key.pem
auditor.csr
auditor.pem
prime256v1.pemIn this case:
auditor-key.pem
is the private key file for ScalarDL Auditor.auditor.pem
is the certificate file for ScalarDL Auditor.
-
Create an EC parameter.
openssl ecparam -name prime256v1 -out prime256v1.pem
-
Create a private key and CSR.
openssl req -new -newkey ec:prime256v1.pem -nodes -keyout client-key.pem -out client.csr
-
Convert the
PKCS#8
key to theSEC1
key.openssl ec -in client-key.pem -out client-key.pem
-
Create a certificate for the client.
openssl x509 -req -days 3650 -signkey client-key.pem -in client.csr -out client.pem
-
Confirm that the private key and certificate files were created.
ls -1
You should see the following output:
client-key.pem
client.csr
client.pem
prime256v1.pemIn this case:
client-key.pem
is the private key file for the client.client.pem
is the certificate file for the client.
You can ask your CFSSL server to create a certificate file.
Prerequisites
You must install the cfssl and cfssljson command-line tools for the following steps.
Create a private key and certificate file
-
Create a private key and CSR based on the requirements by using a tool such as CFSSL or OpenSSL. You can see an example of how to create a private key and CSR by using the
cfssl
command in the CFSSL tab or theopenssl
command in the OpenSSL tab. -
Request a certificate from your CFSSL server.
note- The
-remote
option is needed to specify the CFSSL server endpoint URI. - The
-bare
option for cfssljson is needed to specify a prefix for the output key files.
- The
- ScalarDL Ledger
- ScalarDL Auditor
- Client
cfssl sign -remote "<IP_ADDRESS_OF_CFSSL_SERVER>:<PORT_OF_CFSSL_SERVER>" -profile "ledger" ledger.csr | cfssljson -bare ledger -
You will get a certificate named ledger.pem
from the CFSSL server. You can use that certificate for ScalarDL Ledger.
cfssl sign -remote "<IP_ADDRESS_OF_CFSSL_SERVER>:<PORT_OF_CFSSL_SERVER>" -profile "auditor" auditor.csr | cfssljson -bare auditor -
You will get a certificate named auditor.pem
from the CFSSL server. You can use that certificate for ScalarDL Auditor.
cfssl sign -remote "<IP_ADDRESS_OF_CFSSL_SERVER>:<PORT_OF_CFSSL_SERVER>" -profile "client" client.csr | cfssljson -bare client -
You will get a certificate named client.pem
from the CFSSL server. You can use that certificate for the clients.
You can use a third-party CA or your private CA to create a certificate file. For details on how to create a certificate file, please ask your preferred third-party CA or private CA.