X.509: Private / Public Key

The basics command line steps to generate a private and public key using OpenSSL are as follow openssl genrsa -out private.key 1024 openssl req -new -x509 -key private.key -out publickey.cer -days 365 openssl pkcs12 -export -out public_privatekey.pfx -inkey private.key -in publickey.cer Step 1 – generates a private key Step 2 – creates a X509 certificate … Read more

Creating an x509 v3 user certificate by signing CSR

You need to specify an extensions file. For example: openssl x509 -days 365 -in myCSR.csr -extfile v3.ext -CA myCA.crt -CAkey myCA.key -CAcreateserial -out userCertificate.crt The extensions file (v3.ext) can look like this: authorityKeyIdentifier=keyid,issuer basicConstraints=CA:FALSE keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment

openssl verify – error 20 at 0 depth lookup:unable to get local issuer certificate

OpenSSL> verify -CAfile C:\mycert.pem C:\mycert.pem Close. You need to add the CA’s root certificate with -CAfile; and not your end entity certificate. Something like: openssl verify -CAfile C:\ca-cert.pem C:\mycert.pem Also, if there is an intermediate certificate, then it needs to be added to mycert.pem. So mycert.pem will actually have two (or more) certificates (rather than … Read more

How to create public and private key with openssl?

You can generate a public-private keypair with the genrsa context (the last number is the keylength in bits): openssl genrsa -out keypair.pem 2048 To extract the public part, use the rsa context: openssl rsa -in keypair.pem -pubout -out publickey.crt Finally, convert the original keypair to PKCS#8 format with the pkcs8 context: openssl pkcs8 -topk8 -inform … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)