Maybe a Bug in BC 1.49 and above

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Maybe a Bug in BC 1.49 and above

RealWotan

Hello,

 

maybe i found a bug in BC 1.49 (also 1.50 beta3), but in BC 1.48 it works fine:

 

                                               String toDecode = "MIIFmjCCBIKgAwIBAgIHANcycMdi8DANBgkqhkiG9w0BAQUFADBJMQs" +

                                                                               "wCQYDVQQGEwJERTEZMBcGA1UEChMQUEtJLTEtVmVyd2FsdHVuZzEMMAoGA1UECxMD" +

                                                                               "RE9JMREwDwYDVQQDEwhET0kgQ0EgMjAeFw0xMDEwMTkxNDIzNTJaFw0xMzEwMTkyM" +

                                                                               "zU5NTlaMIGRMQswCQYDVQQGEwJERTEWMBQGA1UEChMNTmllZGVyc2FjaHNlbjETMB" +

                                                                               "EGA1UECxMKTkRTLUp1c3RpejEdMBsGA1UECxMUSnVzdGl6IE5pZWRlcnNhY2hzZW4" +

                                                                               "xCTAHBgNVBAcTADEfMB0GA1UEAxMWTmV1bWFubi1IYW1tZXIgQ2hyaXN0YTEKMAgG" +

                                                                               "A1UEBRMBMTCCASMwDQYJKoZIhvcNAQEBBQADggEQADCCAQsCggEBALyjNAmV5pId7" +

                                                                               "xWz15WpeqbMVOX/QD8ZfnUrx90unO1kAAuuSQMA+LhIK4Avue2FS3q2Lfbe1UuKHa" +

                                                                              "1sE+72YCRt6zPv0dmo4QJ/LiAADs7p2CzJSYEf5b5GoMffKrigj8RWYp2eKrUra6I" +

                                                                              "akWtq+UWLnhf8vGwf1pEpjDJi0Z8noUQpxmHygrj2/B8OEMtD1sgHUlBQHFPOocuo" +

                                                                              "T4LhZbnDuB/XI96e/L0JDGIBs/P5Ke1GvI2PiAW8fbVw8AOm6lIB76htQicReluYm" +

                                                                              "N7xvE4jqHIIQFik0gyrIpADIQxEBxbxJfgZ4zitwX2sIjVOMAdsr0+DvC4cUB8jcU" +

                                                                               "hEvYMCBEAAAIGjggI7MIICNzBvBgNVHSMEaDBmgBTLcHIoAqKnPzTZGkWKqeytzZ0" +

                                                                               "ALaFKpEgwRjELMAkGA1UEBhMCREUxGTAXBgNVBAoTEFBLSS0xLVZlcndhbHR1bmcx" +

                                                                               "HDAaBgNVBAMTE1BDQS0xLVZlcndhbHR1bmctMDmCAkB8MDkGA1UdEQQyMDCBLmNoc" +

                                                                               "mlzdGEubmV1bWFubi1oYW1tZXJAanVzdGl6Lm5pZWRlcnNhY2hzZW4uZGUwggEhBg" +

                                                                              "NVHR8EggEYMIIBFDCCARCgggEMoIIBCIZcbGRhcDovL3g1MDAuYnVuZC5kZS9DTj1" +

                                                                              "ET0klMjBDQSUyMDIsT1U9RE9JLE89UEtJLTEtVmVyd2FsdHVuZyxDPURFP2NlcnRp" +

                                                                              "ZmljYXRlUmV2b2NhdGlvbkxpc3SGaGxkYXA6Ly9wa2ktZGlyZWN0b3J5LmRvaS1kZ" +

                                                                              "S5uZXQvQ049RE9JJTIwQ0ElMjAyLE9VPURPSSxPPVBLSS0xLVZlcndhbHR1bmcsQz" +

                                                                               "1ERT9jZXJ0aWZpY2F0ZVJldm9jYXRpb25MaXN0hj5odHRwOi8veDUwMC5idW5kLmR" +

                                                                               "lL2NnaS1iaW4vc2hvd19hdHRyP2NuPURPSSUyMENBJTIwMiZhdHRyPWNybDAWBgNV" +

                                                                               "HSAEDzANMAsGCSsGAQQBvXQBATAOBgNVHQ8BAf8EBAMCBkAwPAYIKwYBBQUHAQEEM" +

                                                                               "DAuMCwGCCsGAQUFBzABhiBodHRwOi8vb2NzcC5kb2kudGVsZXNlYy5kZS9vY3Nwcj" +

                                                                               "ANBgkqhkiG9w0BAQUFAAOCAQEAWjuM+usXQ2e0JZsXw0JgBUBWjMAvqCqGL01WfNe" +

                                                                              "HUzXZQPHCSa6sKT8LrcJ2wp1o84Fs4upYc7ju+3cgofTSZFetmeHOkGSWAcz3AgjK" +

                                                                              "XEcuWDdyged23LKKJm7ZUzySrM/n9EJmyHr/KBv0gxfqHhJlNSVnQJBa0IrcyhlX3" +

                                                                              "7NWvvadQurMqrgL7434ZIp6MusTDgc2XKG48i2D03jB8HbCf9NCkOwv4a9Kz4kZoX" +

                                                                               "1tVLzx2kWuDzegroXAhKmWD2XArlowaQubJQ+BAwBVniX3rWBOW0GBpwF6hdauHAb" +

                                                                              "XYIS8VAJDq0BQ/Fsvudj03vzeo/Y5qIyHgu++rryvzQ==";

 

                                               byte[] Cert = new sun.misc.BASE64Decoder().decodeBuffer(toDecode);

                                              

                                               ByteArrayInputStream inStreamCert = new ByteArrayInputStream(Cert);

 

                                               CertificateFactory cf = CertificateFactory.getInstance("X.509",

                                                                              "BC");

                                               Certificate cert = (Certificate) cf

                                                                              .generateCertificate(inStreamCert);

 

                                               X509Certificate x509CertUser = (X509Certificate) cf

                                                                              .generateCertificate(new ByteArrayInputStream(cert

                                                                                                              .getEncoded()));

                                              

                                               System.out.println(x509CertUser.toString());

 

 

The "System.out.println(x509CertUser.toString());" throws an execption in BC 1.49 (also 1.50 beta3):

 

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 2

                at java.lang.StringBuffer.charAt(Unknown Source)

                at org.bouncycastle.asn1.x509.X509Name.appendValue(X509Name.java:1272)

                at org.bouncycastle.asn1.x509.X509Name.toString(X509Name.java:1321)

                at org.bouncycastle.asn1.x509.X509Name.toString(X509Name.java:1379)

                at java.lang.String.valueOf(Unknown Source)

                at java.lang.StringBuffer.append(Unknown Source)

 

regards

Lars

 

Reply | Threaded
Open this post in threaded view
|

Re: Maybe a Bug in BC 1.49 and above

David Hook

I've update the latest beta with a fix for this.

http://www.bouncycastle.org/betas

Regards,

David

On 11/07/13 19:13, Lars Denkewitz wrote:

String toDecode = "MIIFmjCCBIKgAwIBAgIHANcycMdi8DANBgkqhkiG9w0BAQUFADBJMQs" +

                                                                               "wCQYDVQQGEwJERTEZMBcGA1UEChMQUEtJLTEtVmVyd2FsdHVuZzEMMAoGA1UECxMD" +

                                                                               "RE9JMREwDwYDVQQDEwhET0kgQ0EgMjAeFw0xMDEwMTkxNDIzNTJaFw0xMzEwMTkyM" +

                                                                               "zU5NTlaMIGRMQswCQYDVQQGEwJERTEWMBQGA1UEChMNTmllZGVyc2FjaHNlbjETMB" +

                                                                               "EGA1UECxMKTkRTLUp1c3RpejEdMBsGA1UECxMUSnVzdGl6IE5pZWRlcnNhY2hzZW4" +

                                                                               "xCTAHBgNVBAcTADEfMB0GA1UEAxMWTmV1bWFubi1IYW1tZXIgQ2hyaXN0YTEKMAgG" +

                                                                               "A1UEBRMBMTCCASMwDQYJKoZIhvcNAQEBBQADggEQADCCAQsCggEBALyjNAmV5pId7" +

                                                                               "xWz15WpeqbMVOX/QD8ZfnUrx90unO1kAAuuSQMA+LhIK4Avue2FS3q2Lfbe1UuKHa" +

                                                                              "1sE+72YCRt6zPv0dmo4QJ/LiAADs7p2CzJSYEf5b5GoMffKrigj8RWYp2eKrUra6I" +

                                                                              "akWtq+UWLnhf8vGwf1pEpjDJi0Z8noUQpxmHygrj2/B8OEMtD1sgHUlBQHFPOocuo" +

                                                                              "T4LhZbnDuB/XI96e/L0JDGIBs/P5Ke1GvI2PiAW8fbVw8AOm6lIB76htQicReluYm" +

                                                                              "N7xvE4jqHIIQFik0gyrIpADIQxEBxbxJfgZ4zitwX2sIjVOMAdsr0+DvC4cUB8jcU" +

                                                                               "hEvYMCBEAAAIGjggI7MIICNzBvBgNVHSMEaDBmgBTLcHIoAqKnPzTZGkWKqeytzZ0" +

                                                                               "ALaFKpEgwRjELMAkGA1UEBhMCREUxGTAXBgNVBAoTEFBLSS0xLVZlcndhbHR1bmcx" +

                                                                               "HDAaBgNVBAMTE1BDQS0xLVZlcndhbHR1bmctMDmCAkB8MDkGA1UdEQQyMDCBLmNoc" +

                                                                               "mlzdGEubmV1bWFubi1oYW1tZXJAanVzdGl6Lm5pZWRlcnNhY2hzZW4uZGUwggEhBg" +

                                                                              "NVHR8EggEYMIIBFDCCARCgggEMoIIBCIZcbGRhcDovL3g1MDAuYnVuZC5kZS9DTj1" +

                                                                              "ET0klMjBDQSUyMDIsT1U9RE9JLE89UEtJLTEtVmVyd2FsdHVuZyxDPURFP2NlcnRp" +

                                                                              "ZmljYXRlUmV2b2NhdGlvbkxpc3SGaGxkYXA6Ly9wa2ktZGlyZWN0b3J5LmRvaS1kZ" +

                                                                              "S5uZXQvQ049RE9JJTIwQ0ElMjAyLE9VPURPSSxPPVBLSS0xLVZlcndhbHR1bmcsQz" +

                                                                               "1ERT9jZXJ0aWZpY2F0ZVJldm9jYXRpb25MaXN0hj5odHRwOi8veDUwMC5idW5kLmR" +

                                                                               "lL2NnaS1iaW4vc2hvd19hdHRyP2NuPURPSSUyMENBJTIwMiZhdHRyPWNybDAWBgNV" +

                                                                               "HSAEDzANMAsGCSsGAQQBvXQBATAOBgNVHQ8BAf8EBAMCBkAwPAYIKwYBBQUHAQEEM" +

                                                                               "DAuMCwGCCsGAQUFBzABhiBodHRwOi8vb2NzcC5kb2kudGVsZXNlYy5kZS9vY3Nwcj" +

                                                                               "ANBgkqhkiG9w0BAQUFAAOCAQEAWjuM+usXQ2e0JZsXw0JgBUBWjMAvqCqGL01WfNe" +

                                                                              "HUzXZQPHCSa6sKT8LrcJ2wp1o84Fs4upYc7ju+3cgofTSZFetmeHOkGSWAcz3AgjK" +

                                                                              "XEcuWDdyged23LKKJm7ZUzySrM/n9EJmyHr/KBv0gxfqHhJlNSVnQJBa0IrcyhlX3" +

                                                                              "7NWvvadQurMqrgL7434ZIp6MusTDgc2XKG48i2D03jB8HbCf9NCkOwv4a9Kz4kZoX" +

                                                                               "1tVLzx2kWuDzegroXAhKmWD2XArlowaQubJQ+BAwBVniX3rWBOW0GBpwF6hdauHAb" +

                                                                              "XYIS8VAJDq0BQ/Fsvudj03vzeo/Y5qIyHgu++rryvzQ==";

 

                                               byte[] Cert = new sun.misc.BASE64Decoder().decodeBuffer(toDecode);

                                              

                                               ByteArrayInputStream inStreamCert = new ByteArrayInputStream(Cert);

 

                                               CertificateFactory cf = CertificateFactory.getInstance("X.509",

                                                                              "BC");

                                               Certificate cert = (Certificate) cf

                                                                              .generateCertificate(inStreamCert);

 

                                               X509Certificate x509CertUser = (X509Certificate) cf

                                                                              .generateCertificate(new ByteArrayInputStream(cert

                                                                                                              .getEncoded()));

                                              

                                               System.out.println(x509CertUser.toString());

 

 

The "System.out.println(x509CertUser.toString());" throws an execption in BC 1.49 (also 1.50 beta3):

 

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 2

                at java.lang.StringBuffer.charAt(Unknown Source)

                at org.bouncycastle.asn1.x509.X509Name.appendValue(X509Name.java:1272)

                at org.bouncycastle.asn1.x509.X509Name.toString(X509Name.java:1321)

                at org.bouncycastle.asn1.x509.X509Name.toString(X509Name.java:1379)

                at java.lang.String.valueOf(Unknown Source)

                at java.lang.StringBuffer.append(Unknown Source)

 

regards

Lars

 


Reply | Threaded
Open this post in threaded view
|

AW: [dev-crypto] Maybe a Bug in BC 1.49 and above

RealWotan

Hello David,

 

thank you very much. I will waiting, that’s BC 1.50 is released. Till I want to use BC 1.48, but I cannot download the this from previous-Link (ftp://ftp.bouncycastle.org/pub), because the ftp-server it unreachable (I have the java-binaries, but I need the src-Package also). Is there a temporary server problem? Maybe someone can mail at me the src-package directly?

 

regards

Lars

 

Von: David Hook [mailto:[hidden email]]
Gesendet: Freitag, 12. Juli 2013 01:51
An: dev-crypto@bouncycastle.
org
Betreff: Re: [dev-crypto] Maybe a Bug in BC 1.49 and above

 


I've update the latest beta with a fix for this.

http://www.bouncycastle.org/betas

Regards,

David

On 11/07/13 19:13, Lars Denkewitz wrote:

String toDecode = "MIIFmjCCBIKgAwIBAgIHANcycMdi8DANBgkqhkiG9w0BAQUFADBJMQs" +

                                                                               "wCQYDVQQGEwJERTEZMBcGA1UEChMQUEtJLTEtVmVyd2FsdHVuZzEMMAoGA1UECxMD" +

                                                                               "RE9JMREwDwYDVQQDEwhET0kgQ0EgMjAeFw0xMDEwMTkxNDIzNTJaFw0xMzEwMTkyM" +

                                                                               "zU5NTlaMIGRMQswCQYDVQQGEwJERTEWMBQGA1UEChMNTmllZGVyc2FjaHNlbjETMB" +

                                                                               "EGA1UECxMKTkRTLUp1c3RpejEdMBsGA1UECxMUSnVzdGl6IE5pZWRlcnNhY2hzZW4" +

                                                                               "xCTAHBgNVBAcTADEfMB0GA1UEAxMWTmV1bWFubi1IYW1tZXIgQ2hyaXN0YTEKMAgG" +

                                                                               "A1UEBRMBMTCCASMwDQYJKoZIhvcNAQEBBQADggEQADCCAQsCggEBALyjNAmV5pId7" +

                                                                               "xWz15WpeqbMVOX/QD8ZfnUrx90unO1kAAuuSQMA+LhIK4Avue2FS3q2Lfbe1UuKHa" +

                                                                              "1sE+72YCRt6zPv0dmo4QJ/LiAADs7p2CzJSYEf5b5GoMffKrigj8RWYp2eKrUra6I" +

                                                                              "akWtq+UWLnhf8vGwf1pEpjDJi0Z8noUQpxmHygrj2/B8OEMtD1sgHUlBQHFPOocuo" +

                                                                              "T4LhZbnDuB/XI96e/L0JDGIBs/P5Ke1GvI2PiAW8fbVw8AOm6lIB76htQicReluYm" +

                                                                              "N7xvE4jqHIIQFik0gyrIpADIQxEBxbxJfgZ4zitwX2sIjVOMAdsr0+DvC4cUB8jcU" +

                                                                               "hEvYMCBEAAAIGjggI7MIICNzBvBgNVHSMEaDBmgBTLcHIoAqKnPzTZGkWKqeytzZ0" +

                                                                               "ALaFKpEgwRjELMAkGA1UEBhMCREUxGTAXBgNVBAoTEFBLSS0xLVZlcndhbHR1bmcx" +

                                                                               "HDAaBgNVBAMTE1BDQS0xLVZlcndhbHR1bmctMDmCAkB8MDkGA1UdEQQyMDCBLmNoc" +

                                                                               "mlzdGEubmV1bWFubi1oYW1tZXJAanVzdGl6Lm5pZWRlcnNhY2hzZW4uZGUwggEhBg" +

                                                                              "NVHR8EggEYMIIBFDCCARCgggEMoIIBCIZcbGRhcDovL3g1MDAuYnVuZC5kZS9DTj1" +

                                                                              "ET0klMjBDQSUyMDIsT1U9RE9JLE89UEtJLTEtVmVyd2FsdHVuZyxDPURFP2NlcnRp" +

                                                                              "ZmljYXRlUmV2b2NhdGlvbkxpc3SGaGxkYXA6Ly9wa2ktZGlyZWN0b3J5LmRvaS1kZ" +

                                                                              "S5uZXQvQ049RE9JJTIwQ0ElMjAyLE9VPURPSSxPPVBLSS0xLVZlcndhbHR1bmcsQz" +

                                                                               "1ERT9jZXJ0aWZpY2F0ZVJldm9jYXRpb25MaXN0hj5odHRwOi8veDUwMC5idW5kLmR" +

                                                                               "lL2NnaS1iaW4vc2hvd19hdHRyP2NuPURPSSUyMENBJTIwMiZhdHRyPWNybDAWBgNV" +

                                                                               "HSAEDzANMAsGCSsGAQQBvXQBATAOBgNVHQ8BAf8EBAMCBkAwPAYIKwYBBQUHAQEEM" +

                                                                               "DAuMCwGCCsGAQUFBzABhiBodHRwOi8vb2NzcC5kb2kudGVsZXNlYy5kZS9vY3Nwcj" +

                                                                               "ANBgkqhkiG9w0BAQUFAAOCAQEAWjuM+usXQ2e0JZsXw0JgBUBWjMAvqCqGL01WfNe" +

                                                                              "HUzXZQPHCSa6sKT8LrcJ2wp1o84Fs4upYc7ju+3cgofTSZFetmeHOkGSWAcz3AgjK" +

                                                                              "XEcuWDdyged23LKKJm7ZUzySrM/n9EJmyHr/KBv0gxfqHhJlNSVnQJBa0IrcyhlX3" +

                                                                              "7NWvvadQurMqrgL7434ZIp6MusTDgc2XKG48i2D03jB8HbCf9NCkOwv4a9Kz4kZoX" +

                                                                               "1tVLzx2kWuDzegroXAhKmWD2XArlowaQubJQ+BAwBVniX3rWBOW0GBpwF6hdauHAb" +

                                                                              "XYIS8VAJDq0BQ/Fsvudj03vzeo/Y5qIyHgu++rryvzQ==";

 

                                               byte[] Cert = new sun.misc.BASE64Decoder().decodeBuffer(toDecode);

                                              

                                               ByteArrayInputStream inStreamCert = new ByteArrayInputStream(Cert);

 

                                               CertificateFactory cf = CertificateFactory.getInstance("X.509",

                                                                              "BC");

                                               Certificate cert = (Certificate) cf

                                                                              .generateCertificate(inStreamCert);

 

                                               X509Certificate x509CertUser = (X509Certificate) cf

                                                                              .generateCertificate(new ByteArrayInputStream(cert

                                                                                                              .getEncoded()));

                                              

                                               System.out.println(x509CertUser.toString());

 

 

The "System.out.println(x509CertUser.toString());" throws an execption in BC 1.49 (also 1.50 beta3):

 

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 2

                at java.lang.StringBuffer.charAt(Unknown Source)

                at org.bouncycastle.asn1.x509.X509Name.appendValue(X509Name.java:1272)

                at org.bouncycastle.asn1.x509.X509Name.toString(X509Name.java:1321)

                at org.bouncycastle.asn1.x509.X509Name.toString(X509Name.java:1379)

                at java.lang.String.valueOf(Unknown Source)

                at java.lang.StringBuffer.append(Unknown Source)

 

regards

Lars

 

 

Reply | Threaded
Open this post in threaded view
|

AW: [dev-crypto] Maybe a Bug in BC 1.49 and above

RealWotan

Ok, i became the package from a friend, it seems to be a local internet-connection-problem.

 

Thx at all.

 

Regards

Lars

 

Von: Lars Denkewitz [mailto:[hidden email]]
Gesendet: Freitag, 12. Juli 2013 10:13
An: [hidden email]; [hidden email]
Betreff: AW: [dev-crypto] Maybe a Bug in BC 1.49 and above

 

Hello David,

 

thank you very much. I will waiting, that’s BC 1.50 is released. Till I want to use BC 1.48, but I cannot download the this from previous-Link (ftp://ftp.bouncycastle.org/pub), because the ftp-server it unreachable (I have the java-binaries, but I need the src-Package also). Is there a temporary server problem? Maybe someone can mail at me the src-package directly?

 

regards

Lars

 

Von: David Hook [[hidden email]]
Gesendet: Freitag, 12.
Juli 2013 01:51
An: [hidden email]
Betreff: Re: [dev-crypto] Maybe a Bug in BC 1.49 and above

 


I've update the latest beta with a fix for this.

http://www.bouncycastle.org/betas

Regards,

David

On 11/07/13 19:13, Lars Denkewitz wrote:

String toDecode = "MIIFmjCCBIKgAwIBAgIHANcycMdi8DANBgkqhkiG9w0BAQUFADBJMQs" +

                                                                               "wCQYDVQQGEwJERTEZMBcGA1UEChMQUEtJLTEtVmVyd2FsdHVuZzEMMAoGA1UECxMD" +

                                                                               "RE9JMREwDwYDVQQDEwhET0kgQ0EgMjAeFw0xMDEwMTkxNDIzNTJaFw0xMzEwMTkyM" +

                                                                               "zU5NTlaMIGRMQswCQYDVQQGEwJERTEWMBQGA1UEChMNTmllZGVyc2FjaHNlbjETMB" +

                                                                               "EGA1UECxMKTkRTLUp1c3RpejEdMBsGA1UECxMUSnVzdGl6IE5pZWRlcnNhY2hzZW4" +

                                                                               "xCTAHBgNVBAcTADEfMB0GA1UEAxMWTmV1bWFubi1IYW1tZXIgQ2hyaXN0YTEKMAgG" +

                                                                               "A1UEBRMBMTCCASMwDQYJKoZIhvcNAQEBBQADggEQADCCAQsCggEBALyjNAmV5pId7" +

                                                                               "xWz15WpeqbMVOX/QD8ZfnUrx90unO1kAAuuSQMA+LhIK4Avue2FS3q2Lfbe1UuKHa" +

                                                                              "1sE+72YCRt6zPv0dmo4QJ/LiAADs7p2CzJSYEf5b5GoMffKrigj8RWYp2eKrUra6I" +

                                                                              "akWtq+UWLnhf8vGwf1pEpjDJi0Z8noUQpxmHygrj2/B8OEMtD1sgHUlBQHFPOocuo" +

                                                                              "T4LhZbnDuB/XI96e/L0JDGIBs/P5Ke1GvI2PiAW8fbVw8AOm6lIB76htQicReluYm" +

                                                                              "N7xvE4jqHIIQFik0gyrIpADIQxEBxbxJfgZ4zitwX2sIjVOMAdsr0+DvC4cUB8jcU" +

                                                                               "hEvYMCBEAAAIGjggI7MIICNzBvBgNVHSMEaDBmgBTLcHIoAqKnPzTZGkWKqeytzZ0" +

                                                                               "ALaFKpEgwRjELMAkGA1UEBhMCREUxGTAXBgNVBAoTEFBLSS0xLVZlcndhbHR1bmcx" +

                                                                               "HDAaBgNVBAMTE1BDQS0xLVZlcndhbHR1bmctMDmCAkB8MDkGA1UdEQQyMDCBLmNoc" +

                                                                               "mlzdGEubmV1bWFubi1oYW1tZXJAanVzdGl6Lm5pZWRlcnNhY2hzZW4uZGUwggEhBg" +

                                                                              "NVHR8EggEYMIIBFDCCARCgggEMoIIBCIZcbGRhcDovL3g1MDAuYnVuZC5kZS9DTj1" +

                                                                              "ET0klMjBDQSUyMDIsT1U9RE9JLE89UEtJLTEtVmVyd2FsdHVuZyxDPURFP2NlcnRp" +

                                                                              "ZmljYXRlUmV2b2NhdGlvbkxpc3SGaGxkYXA6Ly9wa2ktZGlyZWN0b3J5LmRvaS1kZ" +

                                                                              "S5uZXQvQ049RE9JJTIwQ0ElMjAyLE9VPURPSSxPPVBLSS0xLVZlcndhbHR1bmcsQz" +

                                                                               "1ERT9jZXJ0aWZpY2F0ZVJldm9jYXRpb25MaXN0hj5odHRwOi8veDUwMC5idW5kLmR" +

                                                                               "lL2NnaS1iaW4vc2hvd19hdHRyP2NuPURPSSUyMENBJTIwMiZhdHRyPWNybDAWBgNV" +

                                                                               "HSAEDzANMAsGCSsGAQQBvXQBATAOBgNVHQ8BAf8EBAMCBkAwPAYIKwYBBQUHAQEEM" +

                                                                               "DAuMCwGCCsGAQUFBzABhiBodHRwOi8vb2NzcC5kb2kudGVsZXNlYy5kZS9vY3Nwcj" +

                                                                               "ANBgkqhkiG9w0BAQUFAAOCAQEAWjuM+usXQ2e0JZsXw0JgBUBWjMAvqCqGL01WfNe" +

                                                                              "HUzXZQPHCSa6sKT8LrcJ2wp1o84Fs4upYc7ju+3cgofTSZFetmeHOkGSWAcz3AgjK" +

                                                                              "XEcuWDdyged23LKKJm7ZUzySrM/n9EJmyHr/KBv0gxfqHhJlNSVnQJBa0IrcyhlX3" +

                                                                              "7NWvvadQurMqrgL7434ZIp6MusTDgc2XKG48i2D03jB8HbCf9NCkOwv4a9Kz4kZoX" +

                                                                               "1tVLzx2kWuDzegroXAhKmWD2XArlowaQubJQ+BAwBVniX3rWBOW0GBpwF6hdauHAb" +

                                                                              "XYIS8VAJDq0BQ/Fsvudj03vzeo/Y5qIyHgu++rryvzQ==";

 

                                               byte[] Cert = new sun.misc.BASE64Decoder().decodeBuffer(toDecode);

                                              

                                               ByteArrayInputStream inStreamCert = new ByteArrayInputStream(Cert);

 

                                               CertificateFactory cf = CertificateFactory.getInstance("X.509",

                                                                              "BC");

                                               Certificate cert = (Certificate) cf

                                                                              .generateCertificate(inStreamCert);

 

                                               X509Certificate x509CertUser = (X509Certificate) cf

                                                                              .generateCertificate(new ByteArrayInputStream(cert

                                                                                                              .getEncoded()));

                                              

                                               System.out.println(x509CertUser.toString());

 

 

The "System.out.println(x509CertUser.toString());" throws an execption in BC 1.49 (also 1.50 beta3):

 

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 2

                at java.lang.StringBuffer.charAt(Unknown Source)

                at org.bouncycastle.asn1.x509.X509Name.appendValue(X509Name.java:1272)

                at org.bouncycastle.asn1.x509.X509Name.toString(X509Name.java:1321)

                at org.bouncycastle.asn1.x509.X509Name.toString(X509Name.java:1379)

                at java.lang.String.valueOf(Unknown Source)

                at java.lang.StringBuffer.append(Unknown Source)

 

regards

Lars