tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sanjeev Srivastava <sanjeev_k_srivast...@yahoo.co.uk>
Subject X509 Certificate Public Key Problem in Displaying - HELP
Date Fri, 11 Mar 2005 01:26:32 GMT
Hi all !

I am facing problem in displaying Public Key. When I
am pasring X509 certificate the Public Key is coming
as a very long String as as given in Format 1 below,
though it should come like as given in Format 2 below.


out.println(x509certificate.getPublicKey());

I am using Bouncy Castle API and after that only the
Public Key is coming like a long String. Please
advice. 


I tried to convert the Public key into byte array then
to String, but it is showing junk charaters. The
encoding for Publick key is ASN.1 DER but its is
giving error.

I need your advice .. Please HELP.......! 

byte buf [] =
x509certificate.getPublicKey().getEncoded();
String s = new String(buf, "UTF-8");
s= new String(s.getBytes("ISO8859_1"), "UTF-8");
out.println(s);


Format 1

RSA Public Key modulus:
cd288334541b89f30faf379131ffaf3160c9a8e8b21068ed9fe79336f10a64bb47f504173f23474dc5271981260c54720d882dd91f9a129fbcb371d380193f47667b8c3528d2b90adf24da9cd65079817a5ad337f7c24ad829922664d1e4986c3a008af5349b65f8ede310fffdb84958dca0de82396b81b1161961b954b6e643
public exponent: 3 


Format 2

SunJSSE RSA public key: public exponent: 010001
modulus: c90a4f87 1cb7a888 b668a7a2 3b6ceb7b 6c1f2ad8
d548a4d3 34b5cdce 32535ed3 d122116a d8afc534 082b8877
fdc6f728 66d0b743 935f868a 80be4a94 e4d953ca 69bbf480
ff0ba33b bb7f88a4 05403841 7d74b823 3499f387 76e8a8ad
a7fd0d91 07cda676 23df07ca d8afaa75 cfc245e7 10bb201d
f6308f10 52b5fb79 66ab41f9


Thanks xue daoming for conversion but its not working
, I tried searching the charset and encoding but no
solution till now....


Best Regards,
Sanjeev

--- xue daoming <xuedaoming@gmail.com> wrote:
> I think you can do as just below:
> byte[] buf  =
> x509certificate.getPublicKey().getEncoded();
> String s = new String(buf);
> 
> 
> On Thu, 10 Mar 2005 02:35:03 +0000 (GMT), Sanjeev
> Srivastava
> <sanjeev_k_srivastava@yahoo.co.uk> wrote:
> > Hi All
> > 
> > Can anybody tell me how to convert this Byte [] to
> > String..
> > 
> > byte[] buf =
> > x509certificate.getPublicKey().getEncoded();
> > 
> > Please help....
> > 
> > Thanks,
> > Sanjeev


Send instant messages to your online friends http://uk.messenger.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message