java的证书签名_java签名证书
importjava.io.FileInputStream;importjava.security.KeyStore;importjava.security.PrivateKey;importjava.security.PublicKey;importjava.security.Signature;importjava.security.cert.Certificate;importjava.security.cert.CertificateFactory;importjava.security.cert.X509Certificate;importjavax.crypto.Cipher;public classCertificateCoder {public static final String CERT_TYPE="X.509";/*** 获取私匙
*@paramkeyStorePath
*@parampwd
*@paramalias
*@returnPrivateKey 私匙
*@throwsException*/
private static PrivateKey getPrivateKey(String keyStorePath,String pwd,String alias) throwsException{
KeyStore ks=getKeyStore(keyStorePath, pwd);return(PrivateKey)ks.getKey(alias, pwd.toCharArray());
}/***
*@paramkeyStorePath
*@parampwd
*@returnkeyStore 密匙库
*@throwsException*/
private static KeyStore getKeyStore(Strin
importjava.io.FileInputStream;importjava.security.KeyStore;importjava.security.PrivateKey;importjava.security.PublicKey;importjava.security.Signature;importjava.security.cert.Certificate;importjava.security.cert.CertificateFactory;importjava.security.cert.X509Certificate;importjavax.crypto.Cipher;public classCertificateCoder {public static final String CERT_TYPE="X.509";/*** 获取私匙 *@paramkeyStorePath *@parampwd *@paramalias *@returnPrivateKey 私匙 *@throwsException*/ private static PrivateKey getPrivateKey(String keyStorePath,String pwd,String alias) throwsException{ KeyStore ks=getKeyStore(keyStorePath, pwd);return(PrivateKey)ks.getKey(alias, pwd.toCharArray()); }/*** *@paramkeyStorePath *@parampwd *@returnkeyStore 密匙库 *@throwsException*/ private static KeyStore getKeyStore(Strin