本文整理了Java中java.security.cert.Certificate.getType()
方法的一些代码示例,展示了Certificate.getType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Certificate.getType()
方法的具体详情如下:
包路径:java.security.cert.Certificate
类名称:Certificate
方法名:getType
[英]Returns the certificate type.
[中]返回证书类型。
代码示例来源:origin: skylot/jadx
public CertificateManager(Certificate cert) {
this.cert = cert;
String type = cert.getType();
if (type.equals(CERTIFICATE_TYPE_NAME) && cert instanceof X509Certificate) {
x509cert = (X509Certificate) cert;
}
}
代码示例来源:origin: square/okhttp
private List<String> names(List<Certificate> certificates) {
ArrayList<String> strings = new ArrayList<>();
for (Certificate cert : certificates) {
if (cert instanceof X509Certificate) {
strings.add(String.valueOf(((X509Certificate) cert).getSubjectDN()));
} else {
strings.add(cert.getType());
}
}
return strings;
}
}
代码示例来源:origin: skylot/jadx
public String generateText() {
StringBuilder str = new StringBuilder();
String type = cert.getType();
if (type.equals(CERTIFICATE_TYPE_NAME)) {
str.append(generateTextForX509());
} else {
str.append(cert.toString());
}
return str.toString();
}
代码示例来源:origin: com.squareup.okhttp3/okhttp
private List<String> names(List<Certificate> certificates) {
ArrayList<String> strings = new ArrayList<>();
for (Certificate cert : certificates) {
if (cert instanceof X509Certificate) {
strings.add(String.valueOf(((X509Certificate) cert).getSubjectDN()));
} else {
strings.add(cert.getType());
}
}
return strings;
}
}
代码示例来源:origin: robovm/robovm
/**
* Returns an alternate object to be serialized.
*
* @return the object to serialize.
* @throws ObjectStreamException
* if the creation of the alternate object fails.
*/
protected Object writeReplace() throws ObjectStreamException {
try {
return new CertificateRep(getType(), getEncoded());
} catch (CertificateEncodingException e) {
throw new NotSerializableException("Could not create serialization object: " + e);
}
}
代码示例来源:origin: robovm/robovm
String s = chain[0].getType();
if (!(chain[0].getPublicKey().getAlgorithm()).equals(privateKey.getAlgorithm())) {
throw new IllegalArgumentException("Algorithm of private key does not match "
if (!s.equals(chain[i].getType())) {
throw new IllegalArgumentException("Certificates from the given chain have "
+ "different types");
代码示例来源:origin: JZ-Darkal/AndroidHttpCapture
Certificate certificate = trustStore.getCertificate(alias);
if (!(certificate instanceof X509Certificate)) {
log.debug("Skipping non-X509Certificate in KeyStore. Certificate type: {}", certificate.getType());
continue;
代码示例来源:origin: stackoverflow.com
try {
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
keystore.load(new FileInputStream("keystoreLocation"), "keystorePassword".toCharArray());
Enumeration<String> aliases = keystore.aliases();
while(aliases.hasMoreElements()){
String alias = aliases.nextElement();
if(keystore.getCertificate(alias).getType().equals("X.509")){
System.out.println(alias + " expires " + ((X509Certificate) keystore.getCertificate(alias)).getNotAfter());
}
}
} catch (Exception e) {
e.printStackTrace();
}
代码示例来源:origin: yidongnan/grpc-spring-boot-starter
/**
* Tries to prepare an {@link Authentication} using the given certificate.
*
* @param cert The certificate to use.
* @return The authentication instance created with the certificate or null if the certificate type is unsupported.
*/
@Nullable
protected Authentication fromCertificate(final Certificate cert) {
if (cert instanceof X509Certificate) {
log.debug("Found X509 certificate");
return new X509CertificateAuthentication((X509Certificate) cert);
} else {
log.debug("Unsupported certificate type: {}", cert.getType());
return null;
}
}
代码示例来源:origin: psi-probe/psi-probe
for (String alias : Collections.list(ks.aliases())) {
attributes = new HashMap<>();
if ("X.509".equals(ks.getCertificate(alias).getType())) {
X509Certificate cert = (X509Certificate) ks.getCertificate(alias);
代码示例来源:origin: org.eclipse.jetty/jetty-util
if (certificate != null && "X.509".equals(certificate.getType()))
代码示例来源:origin: eclipse/leshan
@Override
public X509Certificate decode(InputStream inputStream) throws CertificateException {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Certificate certificate = cf.generateCertificate(inputStream);
if (certificate instanceof X509Certificate) {
return (X509Certificate) certificate;
}
throw new CertificateException(
String.format("%s certificate format is not supported, Only X.509 certificate is supported",
certificate.getType()));
}
};
代码示例来源:origin: OpenAttestation/OpenAttestation
private X509Certificate certificateIn(KeyStore.PrivateKeyEntry certEntry) {
if (certEntry == null) {
return null;
}
Certificate myCertificate = certEntry.getCertificate();
if (myCertificate instanceof X509Certificate) { //if( "X.509".equals(myCertificate.getType()) ) {
return (X509Certificate) myCertificate;
}
throw new IllegalArgumentException("Certificate is not X509: " + myCertificate.getType());
//PublicKey myPublicKey = pkEntry.getCertificate().getPublicKey();
//return new RsaCredential(myPrivateKey, myPublicKey);
}
代码示例来源:origin: OpenAttestation/OpenAttestation
private X509Certificate certificateIn(KeyStore.TrustedCertificateEntry certEntry) {
if (certEntry == null) {
return null;
}
Certificate myCertificate = certEntry.getTrustedCertificate();
if (myCertificate instanceof X509Certificate) { //if( "X.509".equals(myCertificate.getType()) ) {
return (X509Certificate) myCertificate;
}
throw new IllegalArgumentException("Certificate is not X509: " + myCertificate.getType());
//PublicKey myPublicKey = pkEntry.getCertificate().getPublicKey();
//return new RsaCredential(myPrivateKey, myPublicKey);
}
代码示例来源:origin: OpenAttestation/OpenAttestation
private X509Certificate certificateIn(KeyStore.TrustedCertificateEntry certEntry) {
if( certEntry == null ) { return null; }
Certificate myCertificate = certEntry.getTrustedCertificate();
if( myCertificate instanceof X509Certificate ) { //if( "X.509".equals(myCertificate.getType()) ) {
return (X509Certificate)myCertificate;
}
throw new IllegalArgumentException("Certificate is not X509: "+myCertificate.getType());
//PublicKey myPublicKey = pkEntry.getCertificate().getPublicKey();
//return new RsaCredential(myPrivateKey, myPublicKey);
}
代码示例来源:origin: OpenAttestation/OpenAttestation
private X509Certificate certificateIn(KeyStore.PrivateKeyEntry certEntry) {
if( certEntry == null ) { return null; }
Certificate myCertificate = certEntry.getCertificate();
if( myCertificate instanceof X509Certificate ) { //if( "X.509".equals(myCertificate.getType()) ) {
return (X509Certificate)myCertificate;
}
throw new IllegalArgumentException("Certificate is not X509: "+myCertificate.getType());
//PublicKey myPublicKey = pkEntry.getCertificate().getPublicKey();
//return new RsaCredential(myPrivateKey, myPublicKey);
}
代码示例来源:origin: ibinti/bugvm
/**
* Returns an alternate object to be serialized.
*
* @return the object to serialize.
* @throws ObjectStreamException
* if the creation of the alternate object fails.
*/
protected Object writeReplace() throws ObjectStreamException {
try {
return new CertificateRep(getType(), getEncoded());
} catch (CertificateEncodingException e) {
throw new NotSerializableException("Could not create serialization object: " + e);
}
}
代码示例来源:origin: MobiVM/robovm
/**
* Returns an alternate object to be serialized.
*
* @return the object to serialize.
* @throws ObjectStreamException
* if the creation of the alternate object fails.
*/
protected Object writeReplace() throws ObjectStreamException {
try {
return new CertificateRep(getType(), getEncoded());
} catch (CertificateEncodingException e) {
throw new NotSerializableException("Could not create serialization object: " + e);
}
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Returns an alternate object to be serialized.
*
* @return the object to serialize.
* @throws ObjectStreamException
* if the creation of the alternate object fails.
*/
protected Object writeReplace() throws ObjectStreamException {
try {
return new CertificateRep(getType(), getEncoded());
} catch (CertificateEncodingException e) {
throw new NotSerializableException("Could not create serialization object: " + e);
}
}
代码示例来源:origin: apache/cloudstack
final PemObject pemObject = new PemObject(intermediateCert.getType(), intermediateCert.getEncoded());
final StringWriter textWriter = new StringWriter();
try (final PemWriter pemWriter = new PemWriter(textWriter);) {
内容来源于网络,如有侵权,请联系作者删除!