Code example for X509Certificate

Methods: getSigAlgName

0
		// 获得证书 
		X509Certificate x509Certificate = getCertificate(certificatePath);
 
		// 构建签名,由证书指定签名算法 
		Signature signature = Signature.getInstance(x509Certificate
				.getSigAlgName());
 
		// 获取私钥 
		PrivateKey privateKey = getPrivateKeyByKeyStore(keyStorePath, alias,
				password);
 
		// 初始化签名,由私钥构建 
		signature.initSign(privateKey);
 
		signature.update(sign);
 
		return signature.sign();
	} 
 
	/** 
	 * 验证签名