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:
SEC1orPKCS#8keyECDSAas the algorithmP-256as the curve parameterSHA256as 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 -1You 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.pemis the private key file for ScalarDL Ledger.ledger.pemis the certificate file for ScalarDL Ledger.ca.pemis 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 -1You 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.pemis the private key file for ScalarDL Auditor.auditor.pemis the certificate file for ScalarDL Auditor.ca.pemis 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 -1You 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.pemis the private key file for the client.client.pemis the certificate file for the client.ca.pemis 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#8key to theSEC1key.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 -1You should see the following output:
ledger-key.pem
ledger.csr
ledger.pem
prime256v1.pemIn this case:
ledger-key.pemis the private key file for ScalarDL Ledger.ledger.pemis 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#8key to theSEC1key.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 -1You should see the following output:
auditor-key.pem
auditor.csr
auditor.pem
prime256v1.pemIn this case:
auditor-key.pemis the private key file for ScalarDL Auditor.auditor.pemis 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#8key to theSEC1key.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 -1You should see the following output:
client-key.pem
client.csr
client.pem
prime256v1.pemIn this case:
client-key.pemis the private key file for the client.client.pemis 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
cfsslcommand in the CFSSL tab or theopensslcommand in the OpenSSL tab. -
Request a certificate from your CFSSL server.
note- The
-remoteoption is needed to specify the CFSSL server endpoint URI. - The
-bareoption 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.