Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
titleCreate self-signed Certificate using ECDSA
linenumberstrue
# Specify key name used for file names
key_name=signing

# Step 1 - Create Private Key
# openssl ecparam -name secp384r1secp256k1 -genkey -noout -out "${key_name}".key

# Step 2 - Generate and sign Certificate
# openssl req -new -x509 -sha256 -key "${key_name}".key -out "${key_name}".crt -days 5475

# Step 1: Create Private Key and Certificate Signing Request (CSR)
openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:secp256k1  -sha256 -nodes \
    -keyout "${key_name}".key \
    -out "${key_name}".csr \
    -subj "/C=DE/ST=Berlin/L=Berlin/O=SOS/OU=IT/CN=${key_name}"

# Step 2: Create Certificate
openssl x509 -req -days 5475 \
    -signkey "${key_name}".key \
    -in "${key_name}".csr \
    -out "${key_name}".crt \
    -extfile <(printf "keyUsagebasicConstraints=CA:FALSE\nkeyUsage=critical,nonRepudiation,digitalSignature,keyEncipherment\n\n\nextendedKeyUsage=critical,codeSigning\n")

...

  • Step 1: Create Private Key and Certificate Signing Request (CSR)
    • Choice of algorithm such as secp256k1, secp384r1 etc. is up to the user.
    • The -subj option specifies the distinguished name used for the subject and issuer of the CSR and certificate.
    • The following files will be created with this step:
      • The <key_name>.key file will hold the Private Key.
      • The <key_name>.csr file will hold the Certificate Signing Request.
  • Step 2: Create Certificate
    • The -days argument optionally specifies the validity period of the Certificate.
    • The following files will be created with this step:
      • The <key_name>.crt file will hold the self-signed Certificate.

...