Hot answers tagged

138

The documentation wasn't very clear to me, but it had the answer, the challenge was not being able to see an example. Here's how to do it: openssl aes-256-cbc -in some_file.enc -out some_file.unenc -d -pass pass:somepassword Notice that the command line command syntax is always -pass followed by a space and then the type of passphrase you're providing, i....


85

It's possible to convert your ssh public key to PEM format(that 'openssl rsautl' can read it): Example: ssh-keygen -f ~/.ssh/id_rsa.pub -e -m PKCS8 > id_rsa.pem.pub Assuming 'myMessage.txt' is your message which should be public-key encrypted. Then just encrypt your message with openssl rsautl and your converted PEM public-key as you would normally ...


53

Prebuilt openssl.cnf Info, with commands required beginning on Line 430 Certificate Authorities & Intermediate CAs Self-signed CA keyUsage: cRLSign, digitalSignature, keyCertSign Should not contain any other KUs or EKUs V3 Profile: [ v3_ca ] basicConstraints = critical, CA:TRUE subjectKeyIdentifier = hash authorityKeyIdentifier = keyid:...


47

No, Heartbleed doesn't really affect SSH keys, so you probably don't need to replace the SSH keys you've been using. First, SSL and SSH are two different security protocols for two different uses. Likewise, OpenSSL and OpenSSH are also two completely different software packages, despite the similarities in their names. Second, the Heartbleed exploit causes ...


38

Its a bug in OSX. You can import from the command line as per this answer: https://stackoverflow.com/a/11979625/59198 The command is: security import pub_key.pem -k ~/Library/Keychains/login.keychain You'll then need to rename the key in keychain.app


36

Near as I can tell, -config is overriding some sort of internal config; if you see the "EXAMPLES" section for the man page for openssl req, it shows an example of a config file with distinguished_name in it. On a hunch, I added the following to my config: [req] … distinguished_name = req_distinguished_name [req_distinguished_name] # empty. Thus, my entire ...


35

While reading the documentation for subjectAltName, I noticed, that my certificate has shown Version: 1 while the documentation show Version: 3. To get a Version 3 certificate, I specified the -extfile option: sudo openssl x509 -req -in ./../nginx/ssl/${filename}.csr -CA ~/ssl/rootCA.pem -CAkey ~/ssl/rootCA.key -CAcreateserial -out ./../nginx/ssl/${...


27

Do openssl pkcs8 -topk8 to convert a private key from traditional format to pkcs#8 format. This format -----BEGIN RSA PRIVATE KEY----- -----END RSA PRIVATE KEY----- is referred to as "SSLeay format" or "traditional format" for private key. I'm not sure which format your key is, so I'll demonstrate the idea with a private key generated by genrsa. When ...


26

By definition, a self-signed certificate can be trusted only through direct trust, i.e. what Web browsers like Firefox show as the "allow exception" process. One very specific certificate, down to the last bit, is declared as "trusted". Nothing can be changed in a certificate without exiting from this model, and, in particular, the expiry date, which is part ...


24

TCP connection reset by peer This error from NSS is the same error you get with openssl (errno=104: ECONNRESET). This simply means, that the peer or some middlebox in between (firewall) is terminating the connection. Since the site is reachable from my place I would suggest, that there is a firewall on your site blocking the connection. The behavior is ...


24

After a while I figured it out: this particular load balancer was configured to use only TLSv1.2, which the version of openssl included in OS X (0.9.8) does not understand. I installed a newer version of openssl (>= 1.0.1) using homebrew so this works: /usr/local/opt/openssl/bin/openssl s_client -showcerts -connect lb.example.com:443


21

This website explains very well how to do this: The magic of CSR generation without being prompted for values which go in the certificate's subject field, is in the -subj option. -subj arg Replaces subject field of input request with specified data and outputs modified request. The arg must be formatted as /type0=value0/type1=value1/type2=..., ...


18

To restart PHP on IIS, you actually need to restart IIS: Click Start, click Run, type IISReset, and then click OK.


18

You didn't provide the actual address of the website, nor the SSL provider's name, nor any other information about the certificate, and basically want us to guess at various possible causes. My guess is that your certificate chain ends with "AddTrust External Root" as the topmost CA, and that root certificate just expired several hours ago. Sectigo, the ...


17

Any CA certificate, no matter if it's a root or an intermediate, must have the keyCertSign extension. If you want to sign a revocation list (CRL) with the CA certificate as well (you usually do want that), than you have to add cRLSign as well. Any other keyUsages can and should be avoided for CA certificates. The list of values accepted by openssl is ...


17

While installing the renewed certificate, I discovered that the problem was caused by specifying (for the domain and for each subdomain) in ISPConfig the entire set of data necessary for HTTPS: certificate, private key, CA chain, etc. Put differently, removing the set of data led to the Qualys test to grade the domain A and at the same time remove the ...


17

You don't have to cat the two certificates together in order to verify them. If you have the following three certificates: root.pem - stores a self-signed certificate. intermediate.pem - stores a certificate signed by root.pem john.pem - stores a certificate signed by intermediate.pem And you trust only root.pem, then you would verify john.pem with the ...


17

I don't know of an easy to use command-line switch, but in the openssl s_client command line, you can add the -msg option to get an hexadecimal dump of the handshake message. Then look for the ServerKeyExchange message; it should look like this: <<< TLS 1.2 Handshake [length 030f], ServerKeyExchange 0c 00 03 0b 01 00 ff ff ff ff ff ff ff ff c9 ...


17

I had the same problem and found the response here: https://www.citrix.com/blogs/2015/04/10/how-to-create-a-csr-for-a-san-certificate-on-netscaler/ The config file looks like this: [req] distinguished_name = req_distinguished_name req_extensions = v3_req prompt = no [req_distinguished_name] C = US ST = VA L = SomeCity O = MyCompany OU = MyDivision CN = ...


17

For a list of possible curve names, run: openssl ecparam -list_curves Then, pick a curve from the list and replace your first line with: openssl ecparam -name secp521r1 -genkey -noout -out my.key.pem (replace secp521r1 with whichever curve you choose from the list) Finally, generate the CSR as you have done: openssl req -new -sha256 -key my.key.pem -...


17

Sorry guys, few minutes later I found the answer on Debian bug tracker by Sebastian Andrzej Siewior: Debian Bug report #843064 bah. They changed the default digest from md5 to sha256 to create the key. If you add '-md md5' to your 1.1. openssl then it will work. The other way around you need '-md sha256' to keep 1.0 happy. So by adding "-md md5" on ...


16

Use AES, e.g. AES256 instead of Triple DES: openssl rsa -aes256 -in server.key -out newserver.key


16

Private keys should have reading heavily restricted. Setting permissions to 600 and owned by root should work. However, there are other secure permissions settings - Ubuntu stores keys in a directory with owner root and group ssl-cert and permissions 710. This means that only members of ssl-cert can access any files in that directory. Private keys then have ...


16

I had the same issue and wrote this... It's quick and dirty, but should work. It'll log (and print to screen with debugging on) any certs which aren't yet valid or expire in the next 90 days. Might contain some bugs, but feel free to tidy it up. #!/bin/sh DEBUG=false warning_days=90 # Number of days to warn about soon-to-expire certs certs_to_check='...


15

A certificate has only the public key, not the private one. When they're in PEM format, sometimes both the private key and the certificate are in the same file. Look for a BEGIN PRIVATE KEY or BEGIN RSA PRIVATE KEY header. If you find one, just separate the two blobs using a regular text editor. But if you have only the certificate, then you absolutely ...


14

I used -passin and -passout to set passwords to both files in example: openssl pkcs12 -in voip.p12 -out voip.pem -passin pass:123 -passout pass:321 where 123 and 321 are password


13

The following configuration is (or used to be) the best configuration according to SSLLabs: SSLProtocol +TLSv1.2 +TLSv1.1 +TLSv1 SSLCompression off SSLHonorCipherOrder on SSLCipherSuite "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-...


12

@RiggsFolly has the right idea. Additionally I had to: Copy php.ini-development to php.ini Uncomment the extension=php_openssl.dll line as described Uncomment this line: extension_dir = "ext" Make sure you find php_openssl.dll within that extension directory of course


11

This worked for me: test-no-cn.cnf file [req] default_bits = 4096 encrypt_key = no default_md = sha256 distinguished_name = req_distinguished_name req_extensions = v3_req [ req_distinguished_name ] [ v3_req ] keyUsage = nonRepudiation, digitalSignature, keyEncipherment subjectAltName=critical,email:certtest@example.com,URI:http://...


11

Fairly sure it's an SHA1 digest algorithm but in all honesty I can't say with 100% certainty. And who would have thought that something designed to increase obtuseness would have obtuse instructions ;) EDIT: This may not be helpful in your circumstances but I guess you could always know by doing openssl enc -d -a -md sha1 -aes-256-cbc -nosalt -p


Only top voted, non community-wiki answers of a minimum length are eligible