org.bouncycastle.asn1.x509.Extension.getExtnId()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(144)

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

Extension.getExtnId介绍

暂无

代码示例

代码示例来源:origin: redfish64/TinyTravelTracker

/**
 * Base Constructor
 *
 * @param extension a single extension.
 */
public Extensions(
  Extension extension)
{
  this.ordering.addElement(extension.getExtnId());
  this.extensions.put(extension.getExtnId(), extension);
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

/**
 * Base Constructor
 *
 * @param extension a single extension.
 */
public Extensions(
  Extension extension)
{
  this.ordering.addElement(extension.getExtnId());
  this.extensions.put(extension.getExtnId(), extension);
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

/**
 * Add a given extension.
 *
 * @param extension the full extension value.
 */
public void addExtension(
  Extension extension)
{
  if (extensions.containsKey(extension.getExtnId()))
  {
    throw new IllegalArgumentException("extension " + extension.getExtnId() + " already added");
  }
  extOrdering.addElement(extension.getExtnId());
  extensions.put(extension.getExtnId(), extension);
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

/**
 * Base Constructor
 *
 * @param extensions an array of extensions.
 */
public Extensions(
  Extension[] extensions)
{
  for (int i = 0; i != extensions.length; i++)
  {
    Extension ext = extensions[i];
    this.ordering.addElement(ext.getExtnId());
    this.extensions.put(ext.getExtnId(), ext);
  }
}

代码示例来源:origin: redfish64/TinyTravelTracker

/**
 * Base Constructor
 *
 * @param extensions an array of extensions.
 */
public Extensions(
  Extension[] extensions)
{
  for (int i = 0; i != extensions.length; i++)
  {
    Extension ext = extensions[i];
    this.ordering.addElement(ext.getExtnId());
    this.extensions.put(ext.getExtnId(), ext);
  }
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

/**
 * Constructor from ASN1Sequence.
 * <p>
 * The extensions are a list of constructed sequences, either with (OID, OctetString) or (OID, Boolean, OctetString)
 * </p>
 */
private Extensions(
  ASN1Sequence seq)
{
  Enumeration e = seq.getObjects();
  while (e.hasMoreElements())
  {
    Extension ext = Extension.getInstance(e.nextElement());
    if (extensions.containsKey(ext.getExtnId()))
    {
      throw new IllegalArgumentException("repeated extension found: " + ext.getExtnId());
    }
    
    extensions.put(ext.getExtnId(), ext);
    ordering.addElement(ext.getExtnId());
  }
}

代码示例来源:origin: redfish64/TinyTravelTracker

/**
 * Constructor from ASN1Sequence.
 * <p>
 * The extensions are a list of constructed sequences, either with (OID, OctetString) or (OID, Boolean, OctetString)
 * </p>
 */
private Extensions(
  ASN1Sequence seq)
{
  Enumeration e = seq.getObjects();
  while (e.hasMoreElements())
  {
    Extension ext = Extension.getInstance(e.nextElement());
    extensions.put(ext.getExtnId(), ext);
    ordering.addElement(ext.getExtnId());
  }
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public boolean equals(
  Object  o)
{
  if (!(o instanceof Extension))
  {
    return false;
  }
  Extension other = (Extension)o;
  return other.getExtnId().equals(this.getExtnId())
    && other.getExtnValue().equals(this.getExtnValue())
    && (other.isCritical() == this.isCritical());
}

代码示例来源:origin: redfish64/TinyTravelTracker

public boolean equals(
  Object  o)
{
  if (!(o instanceof Extension))
  {
    return false;
  }
  Extension other = (Extension)o;
  return other.getExtnId().equals(this.getExtnId())
    && other.getExtnValue().equals(this.getExtnValue())
    && (other.isCritical() == this.isCritical());
}

代码示例来源:origin: redfish64/TinyTravelTracker

public int hashCode()
{
  if (this.isCritical())
  {
    return this.getExtnValue().hashCode() ^ this.getExtnId().hashCode();
  }
  return ~(this.getExtnValue().hashCode() ^ this.getExtnId().hashCode());
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public int hashCode()
{
  if (this.isCritical())
  {
    return this.getExtnValue().hashCode() ^ this.getExtnId().hashCode();
  }
  return ~(this.getExtnValue().hashCode() ^ this.getExtnId().hashCode());
}

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

private OCSPReq generateOCSPRequest(X509Certificate issuerCert, BigInteger serialNumber) throws CertificateEncodingException, OperatorCreationException, OCSPException, IOException {
  Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
  OCSPReqBuilder gen = new OCSPReqBuilder();
  gen.addRequest(new JcaCertificateID(new JcaDigestCalculatorProviderBuilder().setProvider("BC").build().get(CertificateID.HASH_SHA1), issuerCert, serialNumber));
  BigInteger nonce = BigInteger.valueOf(System.currentTimeMillis());
  Extension ext = new Extension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce, true, new DEROctetString(nonce.toByteArray()));
  gen.setRequestExtensions(new Extensions(new Extension[]{ext}));
  sentNonce = ext.getExtnId().getEncoded();
  return gen.build();
}

代码示例来源:origin: vmware/admiral

private static List<ExtensionHolder> getServerExtensions(X509Certificate issuerCertificate)
    throws CertificateEncodingException, NoSuchAlgorithmException, IOException {
  List<ExtensionHolder> extensions = new ArrayList<>();
  // SSO forces us to allow data encipherment
  extensions.add(new ExtensionHolder(Extension.keyUsage, true, new KeyUsage(
      KeyUsage.digitalSignature
          | KeyUsage.keyEncipherment
          | KeyUsage.dataEncipherment)));
  extensions.add(new ExtensionHolder(Extension.extendedKeyUsage, true,
      new ExtendedKeyUsage(KeyPurposeId.id_kp_serverAuth)));
  Extension authorityKeyExtension = new Extension(Extension.authorityKeyIdentifier, false,
      new DEROctetString(new JcaX509ExtensionUtils()
          .createAuthorityKeyIdentifier(issuerCertificate)));
  extensions.add(new ExtensionHolder(authorityKeyExtension.getExtnId(),
      authorityKeyExtension.isCritical(), authorityKeyExtension.getParsedValue()));
  return extensions;
}

代码示例来源:origin: open-eid/digidoc4j

if(ext != null) {
  if(m_logger.isDebugEnabled())
    m_logger.debug("Ext: " + ext.getExtnId() + " val-len: " + ((ext.getExtnValue() != null) ? ext.getExtnValue().getOctets().length : 0));
  if(ext.getExtnValue() != null && ext.getExtnValue().getOctets() != null && ext.getExtnValue().getOctets().length == 20) {
    nonce2 = ext.getExtnValue().getOctets();

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

BasicOCSPResp basicResponse = (BasicOCSPResp) ocspResponse.getResponseObject();                        
byte[] receivedNonce = basicResponse.getExtension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce).getExtnId().getEncoded();
if (!Arrays.equals(receivedNonce, sentNonce)) {
  throw new OCSPValidationException("Nonce na resposta ocsp não coincide com nonce do pedido ocsp");
if (null == certHolder.getExtension(OCSPObjectIdentifiers.id_pkix_ocsp_nocheck).getExtnId()) {
  throw new OCSPValidationException("Extensão id_pkix_ocsp_nocheck não encontrada no certificado (Politica de Certificados do SCEE)");

代码示例来源:origin: kaikramer/keystore-explorer

/**
 * Creates an X509ExtensionSet object from the extensions in the ASN1 sequence.
 *
 * @param extensions Sequence with extensions.
 */
public X509ExtensionSet(ASN1Sequence extensions) {
  ASN1Encodable[] asn1Encodables = extensions.toArray();
  for (int i = 0; i < asn1Encodables.length; i++) {
    ASN1Encodable asn1Encodable = asn1Encodables[i];
    Extension ext = Extension.getInstance(asn1Encodable);
    if (ext != null) {
      try {
        addExtension(ext.getExtnId().toString(), ext.isCritical(), ext.getExtnValue().getEncoded());
      } catch (IOException e) {
        // ignore exception from getEncoded()
      }
    }
  }
}

代码示例来源:origin: org.xwiki.commons/xwiki-commons-crypto-pkix

@Override
public X509ExtensionBuilder addExtensions(X509Extensions extensionSet) throws IOException
{
  if (extensionSet == null) {
    return this;
  }
  // Optimisation
  if (extensionSet instanceof BcX509Extensions) {
    Extensions exts = ((BcX509Extensions) extensionSet).getExtensions();
    @SuppressWarnings("unchecked")
    Enumeration<ASN1ObjectIdentifier> oids = exts.oids();
    while (oids.hasMoreElements()) {
      ASN1ObjectIdentifier oid = oids.nextElement();
      Extension ext = exts.getExtension(oid);
      this.extensions.addExtension(ext.getExtnId(), ext.isCritical(), ext.getParsedValue());
    }
  } else {
    // Fallback
    for (String oid : extensionSet.getExtensionOID()) {
      this.extensions.addExtension(new ASN1ObjectIdentifier(oid), extensionSet.isCritical(oid),
        extensionSet.getExtensionValue(oid));
    }
  }
  return this;
}

相关文章