650U Newbie Poster


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 extract the serial number using

<%= cert.getSerialNumber %>

. It gives me an output 3. Is this a integer, BigInteger or 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.

<%@ page language="java" contentType="text/html; charset=UTF-8"

<%@ page import="java.math.*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
          <title>Bell Book and CD Store</title>


          <%@page import="java.security.cert.X509Certificate"%>
          <center> <font color="red"> Welcome</font> </center>
              Object o = request.getAttribute("javax.servlet.request.X509Certificate");
              if (o != null) {
              X509Certificate certs[] = (X509Certificate[]) o;
              X509Certificate cert = certs[0];

          <%= cert.getSerialNumber() %>      
            else {
        You are not Authorized!
        Your certificate cannot be found!

        <form method = "post" action = "page2.jsp">
              <input type = submit value = "click me">