File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Extracting information from the certificate

 
Chandra Swaminathan
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am working on client authentication(in a sample JSP application) using certificates.
I have written a code to extract the client information from the client certificate. Now I wanted to use certificate's serial number to identify the particular use from the database.

I extracted the serial number using . It gives me an output 3. Is this a integer, BigInteger or an array value?

Is there any way I can declare this as an another integer variable for example int a = (serial number value)?? I have not played much with jsp so I do not know exactly where to have a code for that in my jsp file.

I would really appreciate if someone could help me. Thanks in advance. I am attaching my code which extracts the serial number from the certificate installed.
[My idea is to identify the particular clients based on the serial number on their ceritificates. if 1 then its X, if 2 then its Y - Is it possible?]

 
Vijitha Kumara
Bartender
Posts: 3908
9
Chrome Fedora Hibernate
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the CodeRanch!

First of all you don't write Java inside JSPs these days. Use Standard actions, JSTL, EL etc...
Is this a integer, BigInteger or an array value?

That's what return form X509Certificate.getSerialNumber() method.

My idea is to identify the particular clients based on the serial number on their ceritificates. if 1 then its X, if 2 then its Y - Is it possible?

Yes. You can use <c:if> tag from JSTL to do this. And you should avoid all the Java code in production (at least in new code).
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Vijitha said, the code surrounded by scriptlet should go on server side. for instance, it makes easier to debug.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seetharaman Venkatasamy wrote:As Vijitha said, the code surrounded by scriptlet should go on server side. for instance, it makes easier to debug.

Code in a JSP is on the server side.

But yes, Java code in a JSP is reprehensible.
 
Chandra Swaminathan
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for your reply.
Next time will try to work on my faults.
Thank you :)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic