java.security.cert.X509Certificate.getPublicKey()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(378)

本文整理了Java中java.security.cert.X509Certificate.getPublicKey()方法的一些代码示例,展示了X509Certificate.getPublicKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。X509Certificate.getPublicKey()方法的具体详情如下:
包路径:java.security.cert.X509Certificate
类名称:X509Certificate
方法名:getPublicKey

X509Certificate.getPublicKey介绍

暂无

代码示例

代码示例来源:origin: Meituan-Dianping/walle

@Override
  public PublicKey getPublicKey() {
    return mDelegate.getPublicKey();
  }
}

代码示例来源:origin: spring-projects/spring-security-oauth

/**
 * Create an RSA public key secret with the given X509 certificate. The private key will be null.
 *
 * @param certificate The certificate.
 */
public RSAKeySecret(X509Certificate certificate) {
 this(certificate.getPublicKey());
}

代码示例来源:origin: wildfly/wildfly

/**
 * Get the account public key.
 *
 * @return the account public key
 */
public PublicKey getPublicKey() {
  return certificate.getPublicKey();
}

代码示例来源:origin: square/okhttp

/** Returns the trusted CA certificate that signed {@code cert}. */
private X509Certificate findByIssuerAndSignature(X509Certificate cert) {
 X500Principal issuer = cert.getIssuerX500Principal();
 Set<X509Certificate> subjectCaCerts = subjectToCaCerts.get(issuer);
 if (subjectCaCerts == null) return null;
 for (X509Certificate caCert : subjectCaCerts) {
  PublicKey publicKey = caCert.getPublicKey();
  try {
   cert.verify(publicKey);
   return caCert;
  } catch (Exception ignored) {
  }
 }
 return null;
}

代码示例来源:origin: square/okhttp

/** Returns true if {@code toVerify} was signed by {@code signingCert}'s public key. */
private boolean verifySignature(X509Certificate toVerify, X509Certificate signingCert) {
 if (!toVerify.getIssuerDN().equals(signingCert.getSubjectDN())) return false;
 try {
  toVerify.verify(signingCert.getPublicKey());
  return true;
 } catch (GeneralSecurityException verifyFailed) {
  return false;
 }
}

代码示例来源:origin: prestodb/presto

@Override public X509Certificate findByIssuerAndSignature(X509Certificate cert) {
 X500Principal issuer = cert.getIssuerX500Principal();
 Set<X509Certificate> subjectCaCerts = subjectToCaCerts.get(issuer);
 if (subjectCaCerts == null) return null;
 for (X509Certificate caCert : subjectCaCerts) {
  PublicKey publicKey = caCert.getPublicKey();
  try {
   cert.verify(publicKey);
   return caCert;
  } catch (Exception ignored) {
  }
 }
 return null;
}

代码示例来源:origin: prestodb/presto

/** Returns true if {@code toVerify} was signed by {@code signingCert}'s public key. */
private boolean verifySignature(X509Certificate toVerify, X509Certificate signingCert) {
 if (!toVerify.getIssuerDN().equals(signingCert.getSubjectDN())) return false;
 try {
  toVerify.verify(signingCert.getPublicKey());
  return true;
 } catch (GeneralSecurityException verifyFailed) {
  return false;
 }
}

代码示例来源:origin: redisson/redisson

@Override
public PublicKey getPublicKey() {
  return unwrap().getPublicKey();
}

代码示例来源:origin: square/okhttp

static ByteString sha1(X509Certificate x509Certificate) {
 return ByteString.of(x509Certificate.getPublicKey().getEncoded()).sha1();
}

代码示例来源:origin: square/okhttp

static ByteString sha256(X509Certificate x509Certificate) {
 return ByteString.of(x509Certificate.getPublicKey().getEncoded()).sha256();
}

代码示例来源:origin: gocd/gocd

public PublicKey getPublicKey() {
  return getFirstCertificate().getPublicKey();
}

代码示例来源:origin: com.squareup.okhttp3/okhttp

/** Returns true if {@code toVerify} was signed by {@code signingCert}'s public key. */
private boolean verifySignature(X509Certificate toVerify, X509Certificate signingCert) {
 if (!toVerify.getIssuerDN().equals(signingCert.getSubjectDN())) return false;
 try {
  toVerify.verify(signingCert.getPublicKey());
  return true;
 } catch (GeneralSecurityException verifyFailed) {
  return false;
 }
}

代码示例来源:origin: wildfly/wildfly

private static boolean issuedBy(final X509Certificate certificate, X509Certificate issuer) {
  if (issuer.getSubjectDN().equals(certificate.getIssuerDN())) {
    try {
      certificate.verify(issuer.getPublicKey());
      return true;
    } catch (Exception e) {
      return false;
    }
  }
  return false;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Get the certificate public key algorithm.
 *
 * @return the certificate public key algorithm (not {@code null})
 */
public String getAlgorithm() {
  return getFirstCertificate().getPublicKey().getAlgorithm();
}

代码示例来源:origin: skylot/jadx

public String generatePublicKey() {
  PublicKey publicKey = x509cert.getPublicKey();
  if (publicKey instanceof RSAPublicKey) {
    return generateRSAPublicKey();
  }
  if (publicKey instanceof DSAPublicKey) {
    return generateDSAPublicKey();
  }
  return "";
}

代码示例来源:origin: wildfly/wildfly

@Override
public PublicKey getPublicKey() {
  return unwrap().getPublicKey();
}

代码示例来源:origin: prestodb/presto

static ByteString sha1(X509Certificate x509Certificate) {
 return ByteString.of(x509Certificate.getPublicKey().getEncoded()).sha1();
}

代码示例来源:origin: prestodb/presto

static ByteString sha256(X509Certificate x509Certificate) {
 return ByteString.of(x509Certificate.getPublicKey().getEncoded()).sha256();
}

代码示例来源:origin: apache/incubator-dubbo

PublicKey publicKey = _cert.getPublicKey();

代码示例来源:origin: apache/incubator-dubbo

PublicKey publicKey = _cert.getPublicKey();

相关文章