本文整理了Java中java.security.cert.CertificateException.getMessage()
方法的一些代码示例,展示了CertificateException.getMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CertificateException.getMessage()
方法的具体详情如下:
包路径:java.security.cert.CertificateException
类名称:CertificateException
方法名:getMessage
暂无
代码示例来源:origin: org.apache.poi/poi-ooxml
public XAdESXLSignatureFacet() {
try {
this.certificateFactory = CertificateFactory.getInstance("X.509");
} catch (CertificateException e) {
throw new RuntimeException("X509 JCA error: " + e.getMessage(), e);
}
}
代码示例来源:origin: square/okhttp
private List
int length = readInt(source);
if (length == -1) return Collections.emptyList(); // OkHttp v1.2 used -1 to indicate null.
try {
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
List
for (int i = 0; i
Buffer bytes = new Buffer();
bytes.write(ByteString.decodeBase64(line));
result.add(certificateFactory.generateCertificate(bytes.inputStream()));
}
return result;
} catch (CertificateException e) {
throw new IOException(e.getMessage());
}
}
代码示例来源:origin: robovm/robovm
public void verify(PublicKey key, String sigProvider)
throws CertificateException,
NoSuchAlgorithmException, InvalidKeyException,
NoSuchProviderException, SignatureException {
try {
cert.verify(key, sigProvider);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
}
}
代码示例来源:origin: robovm/robovm
public void verify(PublicKey key) throws CertificateException,
NoSuchAlgorithmException, InvalidKeyException,
NoSuchProviderException, SignatureException {
try {
cert.verify(key);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
}
}
代码示例来源:origin: spotbugs/spotbugs
private KeyStore initKeyStore(String keystoreFile, String keyPass) throws IOException {
java.io.InputStream istream = null;
KeyStore kstore;
try {
kstore = KeyStore.getInstance("JKS");
istream = new FileInputStream(keystoreFile);
kstore.load(istream, keyPass.toCharArray());
return kstore;
} catch (KeyStoreException e) {
throw new IOException(e.getMessage());
} catch (NoSuchAlgorithmException e) {
throw new IOException(e.getMessage());
} catch (CertificateException e) {
throw new IOException(e.getMessage());
}
}
代码示例来源:origin: k9mail/k-9
private void writeCertificateFile() throws CertificateException {
java.io.OutputStream keyStoreStream = null;
try {
keyStoreStream = new java.io.FileOutputStream(keyStoreFile);
keyStore.store(keyStoreStream, "".toCharArray());
} catch (FileNotFoundException e) {
throw new CertificateException("Unable to write KeyStore: "
+ e.getMessage());
} catch (CertificateException e) {
throw new CertificateException("Unable to write KeyStore: "
+ e.getMessage());
} catch (IOException e) {
throw new CertificateException("Unable to write KeyStore: "
+ e.getMessage());
} catch (NoSuchAlgorithmException e) {
throw new CertificateException("Unable to write KeyStore: "
+ e.getMessage());
} catch (KeyStoreException e) {
throw new CertificateException("Unable to write KeyStore: "
+ e.getMessage());
} finally {
IOUtils.closeQuietly(keyStoreStream);
}
}
代码示例来源:origin: prestodb/presto
private List
int length = readInt(source);
if (length == -1) return Collections.emptyList(); // OkHttp v1.2 used -1 to indicate null.
try {
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
List
for (int i = 0; i
Buffer bytes = new Buffer();
bytes.write(ByteString.decodeBase64(line));
result.add(certificateFactory.generateCertificate(bytes.inputStream()));
}
return result;
} catch (CertificateException e) {
throw new IOException(e.getMessage());
}
}
代码示例来源:origin: com.squareup.okhttp3/okhttp
private List
int length = readInt(source);
if (length == -1) return Collections.emptyList(); // OkHttp v1.2 used -1 to indicate null.
try {
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
List
for (int i = 0; i
Buffer bytes = new Buffer();
bytes.write(ByteString.decodeBase64(line));
result.add(certificateFactory.generateCertificate(bytes.inputStream()));
}
return result;
} catch (CertificateException e) {
throw new IOException(e.getMessage());
}
}
代码示例来源:origin: apollographql/apollo-android
private List
int length = readInt(source);
if (length == -1) return Collections.emptyList(); // OkHttp v1.2 used -1 to indicate null.
try {
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
List
for (int i = 0; i
Buffer bytes = new Buffer();
bytes.write(ByteString.decodeBase64(line));
result.add(certificateFactory.generateCertificate(bytes.inputStream()));
}
return result;
} catch (CertificateException e) {
throw new IOException(e.getMessage());
}
}
代码示例来源:origin: k9mail/k-9
private X509Certificate[] fetchCertificateChain(Context context, String alias)
throws KeyChainException, InterruptedException, MessagingException {
X509Certificate[] chain = KeyChain.getCertificateChain(context, alias);
if (chain == null || chain.length == 0) {
throw new MessagingException("No certificate chain found for: " + alias);
}
try {
for (X509Certificate certificate : chain) {
certificate.checkValidity();
}
} catch (CertificateException e) {
throw new CertificateValidationException(e.getMessage(), Reason.Expired, alias);
}
return chain;
}
代码示例来源:origin: jmdhappy/xxpay-master
public boolean calls() {
boolean isRet = false;
//https
try {
this.callHttps();
isRet = true;
} catch (UnrecoverableKeyException e) {
_log.error("", e);
this.errInfo = e.getMessage();
} catch (KeyManagementException e) {
_log.error("", e);
this.errInfo = e.getMessage();
} catch (CertificateException e) {
_log.error("", e);
this.errInfo = e.getMessage();
} catch (KeyStoreException e) {
_log.error("", e);
this.errInfo = e.getMessage();
} catch (NoSuchAlgorithmException e) {
_log.error("", e);
this.errInfo = e.getMessage();
} catch (IOException e) {
_log.error("", e);
this.errInfo = e.getMessage();
} catch (Exception e) {
_log.error("", e);
this.errInfo = e.getMessage();
}
return isRet;
}
代码示例来源:origin: k9mail/k-9
/**
* Permanently accepts a certificate for the INCOMING or OUTGOING direction
* by adding it to the local key store.
*
* @param certificate
*/
private void acceptCertificate(X509Certificate certificate) {
try {
DI.get(LocalKeyStoreManager.class).addCertificate(mAccount, mDirection.toMailServerDirection(), certificate);
} catch (CertificateException e) {
showErrorDialog(
R.string.account_setup_failed_dlg_certificate_message_fmt,
e.getMessage() == null ? "" : e.getMessage());
}
AccountSetupCheckSettings.actionCheckSettings(AccountSetupCheckSettings.this, mAccount,
mDirection);
}
代码示例来源:origin: robovm/robovm
cf.generateCertificate(inStream);
} catch (java.security.cert.CertificateException e) {
throw new CertificateException(e.getMessage());
代码示例来源:origin: k9mail/k-9
public void checkServerTrusted(X509Certificate[] chain, String authType)
throws CertificateException {
String message;
X509Certificate certificate = chain[0];
Throwable cause;
try {
defaultTrustManager.checkServerTrusted(chain, authType);
new StrictHostnameVerifier().verify(mHost, certificate);
return;
} catch (CertificateException e) {
// cert. chain can't be validated
message = e.getMessage();
cause = e;
} catch (SSLException e) {
// host name doesn't match certificate
message = e.getMessage();
cause = e;
}
// Check the local key store if we couldn't verify the certificate using the global
// key store or if the host name doesn't match the certificate name
if (!keyStore.isValidCertificate(certificate, mHost, mPort)) {
throw new CertificateChainException(message, chain, cause);
}
}
代码示例来源:origin: igniterealtime/Openfire
Log.warn( "EE Certificate not valid: " + e.getMessage() );
return null;
代码示例来源:origin: mrdear/JavaWEB
/**
* 获取证书
*
* @param type
* 类型
* @param inputStream
* 输入流
* @return 证书
*/
public static Certificate getCertificate(String type, InputStream inputStream) {
try {
CertificateFactory certificateFactory = CertificateFactory.getInstance(type, PROVIDER);
return certificateFactory.generateCertificate(inputStream);
} catch (CertificateException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
代码示例来源:origin: hyperledger/fabric-sdk-java
/**
* Resets curve name, hash algorithm and cert factory. Call this method when a config value changes
*
* @throws CryptoException
* @throws InvalidArgumentException
*/
private void resetConfiguration() throws CryptoException, InvalidArgumentException {
setSecurityLevel(securityLevel);
setHashAlgorithm(hashAlgorithm);
try {
cf = CertificateFactory.getInstance(CERTIFICATE_FORMAT);
} catch (CertificateException e) {
CryptoException ex = new CryptoException("Cannot initialize " + CERTIFICATE_FORMAT + " certificate factory. Error = " + e.getMessage(), e);
logger.error(ex.getMessage(), ex);
throw ex;
}
}
代码示例来源:origin: hyperledger/fabric-sdk-java
/**
* addCACertificatesToTrustStore adds a CA certs in a stream to the trust store used for signature validation
*
* @param bis an X.509 certificate stream in PEM format in bytes
* @throws CryptoException
* @throws InvalidArgumentException
*/
public void addCACertificatesToTrustStore(BufferedInputStream bis) throws CryptoException, InvalidArgumentException {
if (bis == null) {
throw new InvalidArgumentException("The certificate stream bis cannot be null");
}
try {
final Collection extends Certificate> certificates = cf.generateCertificates(bis);
for (Certificate certificate : certificates) {
addCACertificateToTrustStore(certificate);
}
} catch (CertificateException e) {
throw new CryptoException("Unable to add CA certificate to trust store. Error: " + e.getMessage(), e);
}
}
代码示例来源:origin: hyperledger/fabric-sdk-java
logger.error("Cannot validate certificate. Error is: " + e.getMessage());
throw new RevocationException("Error while revoking cert. " + e.getMessage(), e);
} catch (Exception e) {
logger.error(e.getMessage(), e);
代码示例来源:origin: hyperledger/fabric-sdk-java
logger.error("Cannot validate certificate. Error is: " + e.getMessage());
throw new RevocationException("Error while revoking cert. " + e.getMessage(), e);
} catch (Exception e) {
logger.error(e.getMessage(), e);