java Êý×ÖÖ¤ÊéÐÅÏ¢µÄ»ñȡʵÀý javaѧϰ±Ê¼Ç(2)
ÓÃjavaÌṩµÄapiʵÏÖ´ÓÖ¤ÊéÎļþ(±¾ÊµÀýʵÑé¶ÔÏóΪ*.cerÎļþ)ÖлñÈ¡ÓÐЧÐÅÏ¢µÄ·½·¨..
public static X509Certificate getCert(String fileName) throws Exception {//´ÓÒ»¸öÓÐЧµÄÖ¤ÊéÎļþÀ´´´½¨Ö¤Êé..
InputStream inStream = new FileInputStream(fileName);
CertificateFactory cf = CertificateFactory.getInstance("X.509");//ÓÃÖ¤Ê鹤³§À´´´½¨Ö¤Êé..
X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream);
inStream.close();
return cert;
}
public static void showCert( X509Certificate cert ) {//Êä³öÖ¤ÊéµÄ¸÷ÏîÐÅÏ¢..
System.out.println("Version: " + cert.getVersion());//Ö¤Êé°æ±¾..
System.out.println("SerialNumber: " + cert.getSerialNumber().toString(16) );//Ö¤ÊéÐòÁкÅ..
System.out.println("SignatureAlgorithm: " + cert.getSigAlgName());//Ö¤ÊéÇ©ÃûËã·¨..
X500Principal principal = cert.getIssuerX500Principal();
System.out.println("IssuerName: \n" + principal.getName(X500Principal.RFC1779));//Ö¤Êé°ä·¢Õß
//System.out.println(principal.hashCode());
GregorianCalendar gcal = new GregorianCalendar();
System.out.print("Validityfrom: ");
gcal.setTime(cert.getNotBefore());//Ö¤ÊéÓÐЧÆÚ´Ó..
System.out.println(gcal.get(GregorianCalendar.YEAR)+"/"+gcal.get(GregorianCalendar.MONTH)+"/"+gcal.get(GregorianCalendar.DAY_OF_MONTH)+" "+gcal.get(GregorianCalendar.HOUR_OF_DAY)+":"+gcal.get(GregorianCalendar.MINUTE)+":"+gcal.get(GregorianCalendar.SECOND));
System.out.print("ValidityTo: ");
gcal.setTime(cert.getNotAfter());//Ö¤ÊéÓÐЧÆÚµ½..
System.out.println(gcal.get(GregorianCalendar.YEAR)+"/"+gcal.get(GregorianCalendar.MONTH)+"/"+gcal.get(GregorianCalendar.DAY_OF_MONTH)+" "+gcal.get(GregorianCalendar.HOUR_OF_DAY)+":"+gcal.get(GregorianCalendar.MINUTE)+":"+gcal.get(GregorianCalendar.SECOND));
principal = cert.getSubjectX500Principal();
System.out.println("SubjectName: \n" + principal.getName(X500Principal.RFC1779));//Ö¤ÊéʹÓÃÕß
PublicKey pkey = cert.getPublicKey();//»ñµÃ¹«Ô¿
Ïà¹ØÎĵµ£º
class_path
.;D:\Program Files\Java\jdk1.5.0_04\lib\tools.jar;D:\Program Files\Java\jdk1.5.0_04\lib\rt.jar;D:\Program Files\Java\jdk1.5.0_04\lib\dt.jar;
path
D:\Program Files\Java\jdk1.5.0_04\bin;D:\Program Files\Java\jre1.5.0_04\bin
java_home
D:\Program Files\Java\jdk1.5.0_04
ÒÔÉÏÅäÖÃÊÇÎÒ»úÆ÷µ ......
ÃæÊÔ¹Ù£ºÊìϤÄÄÖÖÓïÑÔ
ӦƸÕߣºJava¡£
ÃæÊÔ¹Ù£ºÖªµÀʲô½ÐÀàô
ӦƸÕߣºÎÒÕâÈËʵÔÚ£¬¹¤×÷ŬÁ¦£¬²»ÖªµÀʲô½ÐÀÛ
Ãæ
ÊÔ¹Ù£ºÖªµÀʲôÊÇ°ü?
ӦƸÕߣºÎÒÕâÈËʵÔÚ? ƽ³£²»´ø°ü Ò²²»Óù«Ë¾×¼±¸ÁË
ÃæÊÔ¹Ù£ºÖªµÀʲôÊǽӿÚÂð?
ӦƸÕߣºÎÒÕâ¸öÈ˹¤
×÷ÈÏÕæ¡£´ÓÀ´²»ÕÒ½è¿Ú͵ÀÁ
ÃæÊÔ¹Ù£ºÖªµÀʲôÊǼ̳Ðô
ӦƸÕߣºÎÒ ......
±¾ÎÄ°üÀ¨:
A: servletÔ´ÂëʵÀý
B: servlet²¿Êð
C: ¿Í»§¶ËÔ¶³Ìµ÷ÓÃ
D: servlet¿ª·¢µ÷Óù¤¾ß
A: servletÔ´ÂëʵÀý
package com.viewlinecn.userlogin.www.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http ......
windows xpÏÂÅäÖÃJDK»·¾³±äÁ¿£º
1.°²×°JDK£¬°²×°¹ý³ÌÖпÉÒÔ×Ô¶¨Ò尲װĿ¼µÈÐÅÏ¢£¬ÀýÈçÎÒÃÇÑ¡Ôñ°²×°Ä¿Â¼ÎªD:\java\jdk1.5.0_08£»
¡¡ 2.°²×°Íê³Éºó£¬ÓÒ»÷“ÎҵĵçÄÔ”£¬µã»÷“ÊôÐÔ”£»
3.Ñ¡Ôñ“¸ß¼¶”Ñ¡Ï£¬µã»÷“ ......