| 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: 3670
|
|
Welcome to the CodeRanch!
First of all you don't write Java inside JSPs these days. Use Standard actions, JSTL, EL etc...
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: 56168
|
|
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.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About 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 :)
|
 |
 |
|
|
subject: Extracting information from the certificate
|
|
|