File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Extracting information from the certificate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Extracting information from the certificate" Watch "Extracting information from the certificate" New topic
Author

Extracting information from the certificate

Chandra Swaminathan
Greenhorn

Joined: Nov 30, 2011
Posts: 6
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

Joined: Mar 24, 2008
Posts: 3825

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).


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

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

Joined: Jan 10, 2002
Posts: 60990
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Chandra Swaminathan
Greenhorn

Joined: Nov 30, 2011
Posts: 6
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
 
subject: Extracting information from the certificate