use of com.itrus.cryptorole.CryptoException in project portal by ixinportal.
the class TrustService method initSignKey.
/**
* 初始化签名证书
*
* @throws NotSupportException
* @throws CryptoException
*/
public void initSignKey() throws NotSupportException, CryptoException {
try {
Resource resource = new ClassPathResource(ksFileName);
InputStream fis = resource.getInputStream();
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(fis, kspass.toCharArray());
fis.close();
this.keyOfSigner = (PrivateKey) keyStore.getKey(kAliase, kPass.toCharArray());
this.certOfSigner = (java.security.cert.X509Certificate) keyStore.getCertificate(kAliase);
} catch (FileNotFoundException e) {
throw new CryptoException(e);
} catch (KeyStoreException e) {
throw new CryptoException(e);
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
} catch (CertificateException e) {
throw new CryptoException(e);
} catch (IOException e) {
throw new CryptoException(e);
} catch (UnrecoverableKeyException e) {
throw new CryptoException(e);
}
}
Aggregations