Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private keys generated by openssl 1.x can't be loaded #118

Open
vokac opened this issue Nov 14, 2013 · 1 comment
Open

Private keys generated by openssl 1.x can't be loaded #118

vokac opened this issue Nov 14, 2013 · 1 comment

Comments

@vokac
Copy link
Contributor

vokac commented Nov 14, 2013

When I create certificate request with openssl >= 1.x.x (e.g. on SL6)

openssl req -new -keyout mykey.pem -out myreq.pem -config my.cfg

where content of my.cfg is following

default_bits            = 2048
distinguished_name      = req_distinguished_name
string_mask             = nombstr
prompt                  = no
req_extensions          = req_ext
[req_distinguished_name]
commonName             = hostname.domain.com
[req_ext]
subjectAltName          = @san
[san]
DNS.0                   = hostname.domain.com
email.0                 = [email protected]

than I'm not able to load private key using function:

org.globus.gsi.X509Credential("mycert.pem", "mykey.pem");

It is caused by different private key format produced by certificate request created by openssl >= 1.x.x New private key format is incompatible with ssl-proxies-2.0.6.jar.

It is possible to convert new key format into old format using (at least on SL6)

openssl rsa -in mykey.pem -out mykey.pem.old

and old format to new format using

openssl pkcs8 -topk8 -nocrypt -in mykey.pem -out mykey.pem.new

and than one can test this issue e.g. by

import java.io.IOException;
import org.globus.gsi.CredentialException;

public class TestSSL {
    public static void main(String[] args) throws CredentialException, IOException {
        System.out.println("Start");
        new org.globus.gsi.X509Credential("mycert.pem", "mykey.pem.old");
        System.out.println("Old key was read OK");
        new org.globus.gsi.X509Credential("mycert.pem", "mykey.pem.new");
        System.out.println("We'll not get here with current jglobus version 2.0.6");
    }
}
@vokac
Copy link
Contributor Author

vokac commented Sep 22, 2014

workaround to support SL6 openssl default PKCS8 key format a116471

tzok added a commit to tzok/JGlobus that referenced this issue Oct 22, 2015
This is a fork of JGlobus which fixes the following issues:
    jglobus#118
    jglobus#146

Patch provided by https://github.com/vokac
ellert added a commit to ellert/JGlobus that referenced this issue Oct 30, 2018
Fixes the following issues:
 * jglobus#118
 * jglobus#146

Merge remote-tracking branch 'vokac/master' into PKCS8-key-format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant