Package org.bouncycastle.asn1

Examples of org.bouncycastle.asn1.DERIA5String


                    unused += x;
                }
                value = new DERBitString(new byte[] { v }, unused);
            } else if(r_oid.equals(new DERObjectIdentifier("2.5.29.17"))) { //subjectAltName
                if(valuex.startsWith("DNS:")) {
                    value = new String(ByteList.plain(new GeneralNames(new GeneralName(GeneralName.dNSName,new DERIA5String(valuex.substring(4)))).getDEREncoded()));
                } else if(valuex.startsWith("IP:")) {
                    String[] numbers = valuex.substring(3).split("\\.");
                    byte[] bs = new byte[4];
                    bs[0] = (byte) (Integer.parseInt(numbers[0]) & 0xff);
                    bs[1] = (byte) (Integer.parseInt(numbers[1]) & 0xff);
View Full Code Here


    private byte[] internalToDer() throws IOException {
        DERSequence b = (DERSequence)cert.toASN1Object();
        DERObjectIdentifier encType = null;
        DERBitString publicKey = new DERBitString(((PKey)public_key).to_der().convertToString().getBytes());
        DERIA5String encodedChallenge = new DERIA5String(this.challenge.toString());
        DERObjectIdentifier sigAlg = null;
        DERBitString sig = null;
        encType = (DERObjectIdentifier)((DERSequence)((DERSequence)((DERSequence)b.getObjectAt(0)).getObjectAt(0)).getObjectAt(0)).getObjectAt(0);
        sigAlg = ((AlgorithmIdentifier)b.getObjectAt(1)).getObjectId();
        sig = (DERBitString)b.getObjectAt(2);
View Full Code Here

            certificateGenerator.addExtension(Extension.basicConstraints, false, bc);
        }

        if (null != crlUri) {
            int uri = GeneralName.uniformResourceIdentifier;
            DERIA5String crlUriDer = new DERIA5String(crlUri);
            GeneralName gn = new GeneralName(uri, crlUriDer);

            DERSequence gnDer = new DERSequence(gn);
            GeneralNames gns = GeneralNames.getInstance(gnDer);
           
View Full Code Here

    // Colocar aqui 1.3.6.1.5.5.7.48.1
    for (AccessDescription description : accessDescriptions) {
      if (description.getAccessMethod().getId().equals(OCSPObjectIdentifiers.pkix_ocsp)) {
        GeneralName generalName = description.getAccessLocation();
        DERTaggedObject taggedObject = (DERTaggedObject) generalName.toASN1Primitive();
        DERIA5String ia5String = DERIA5String.getInstance(taggedObject.getObject());
        String urlStr = ia5String.getString();
        URL url = new URL(urlStr);
        urls.add(url);
      }
    }
View Full Code Here

      ASN1EncodableVector vector = new ASN1EncodableVector();
      for (Entry<String, String> entry : request.getCertificatePolicies().entrySet()) {
        String oid = entry.getKey();
        String value = entry.getValue();
        ASN1ObjectIdentifier policyIdentifier = new ASN1ObjectIdentifier(oid);
        PolicyQualifierInfo policyQualifierInfo = new PolicyQualifierInfo(X509Extension.cRLDistributionPoints, new DERIA5String(value));
        DERSequence policyQualifiers = new DERSequence(new ASN1Encodable[] { policyQualifierInfo });
        PolicyInformation policyInformation = new PolicyInformation(policyIdentifier, policyQualifiers);
        vector.add(policyInformation);
      }
View Full Code Here

    }
  }

  protected void addV3CRLDistPoint(final JcaX509v3CertificateBuilder builder, final BouncyCastleCertificateRequest request) throws CertIOException {
    if (ConditionUtils.isNotEmpty(request.getCrlDistPoint())) {
      GeneralName gn = new GeneralName(6, new DERIA5String(request.getCrlDistPoint()));

      ASN1EncodableVector vec = new ASN1EncodableVector();
      vec.add(gn);

      GeneralNames generalNames = GeneralNames.getInstance(new DERSequence(vec));
      DistributionPointName distributionPointName = new DistributionPointName(0, generalNames);
      CRLDistPoint crlDistPoint = new CRLDistPoint(new DistributionPoint[] { new DistributionPoint(distributionPointName, null, null) });

      builder.addExtension(X509Extension.cRLDistributionPoints, false, crlDistPoint);
      builder.addExtension(MiscObjectIdentifiers.netscapeCApolicyURL, false, new DERIA5String(request.getCrlDistPoint()));
    }
  }
View Full Code Here

    }
  }

  protected void addV3OcspUrl(final JcaX509v3CertificateBuilder builder, final BouncyCastleCertificateRequest request) throws CertIOException {
    if (ConditionUtils.isNotEmpty(request.getOcspURL())) {
      GeneralName ocspLocation = new GeneralName(6, new DERIA5String(request.getOcspURL()));
      builder.addExtension(X509Extension.authorityInfoAccess, false, new AuthorityInformationAccess(X509ObjectIdentifiers.ocspAccessMethod, ocspLocation));
    }
  }
View Full Code Here

    }
  }

  protected void addV3PolicyUrl(final JcaX509v3CertificateBuilder builder, final BouncyCastleCertificateRequest request) throws CertIOException {
    if (ConditionUtils.isNotEmpty(request.getPolicyURL())) {
      builder.addExtension(MiscObjectIdentifiers.netscapeCApolicyURL, false, new DERIA5String(request.getPolicyURL()));
    }
  }
View Full Code Here

    }
  }

  protected void addV3Comment(final JcaX509v3CertificateBuilder builder, final BouncyCastleCertificateRequest request) throws CertIOException {
    if (ConditionUtils.isNotEmpty(request.getComment())) {
      builder.addExtension(MiscObjectIdentifiers.netscapeCertComment, false, new DERIA5String(request.getComment()));
    }
  }
View Full Code Here

    // Colocar aqui 1.3.6.1.5.5.7.48.1
    for (AccessDescription description : accessDescriptions) {
      if (description.getAccessMethod().getId().equals(OCSPObjectIdentifiers.pkix_ocsp)) {
        GeneralName generalName = description.getAccessLocation();
        DERTaggedObject taggedObject = (DERTaggedObject) generalName.getDERObject();
        DERIA5String ia5String = DERIA5String.getInstance(taggedObject.getObject());
        String urlStr = ia5String.getString();
        URL url = new URL(urlStr);
        urls.add(url);
      }
    }
View Full Code Here

TOP

Related Classes of org.bouncycastle.asn1.DERIA5String

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.