Package org.bouncycastle.asn1

Examples of org.bouncycastle.asn1.ASN1Primitive


        AlgorithmParameterGenerator algorithmparametergenerator = AlgorithmParameterGenerator.getInstance(s);
        AlgorithmParameters algorithmparameters = algorithmparametergenerator.generateParameters();
        ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(algorithmparameters.getEncoded("ASN.1"));
        ASN1InputStream asn1inputstream = new ASN1InputStream(bytearrayinputstream);
        ASN1Primitive derobject = asn1inputstream.readObject();
        KeyGenerator keygenerator = KeyGenerator.getInstance(s);
        keygenerator.init(128);
        SecretKey secretkey = keygenerator.generateKey();
        Cipher cipher = Cipher.getInstance(s);
        cipher.init(1, secretkey, algorithmparameters);
View Full Code Here


            ASN1InputStream din = new ASN1InputStream(new ByteArrayInputStream(contentsKey));

            //
            // Basic checks to make sure it's a PKCS#7 SignedData Object
            //
            ASN1Primitive pkcs;

            try {
                pkcs = din.readObject();
            }
            catch (IOException e) {
View Full Code Here

   * @return  the String where you can check if the certificate was revoked
   * @throws CertificateParsingException
   * @throws IOException
   */
  public static String getCRLURL(X509Certificate certificate) throws CertificateParsingException {
      ASN1Primitive obj;
    try {
      obj = getExtensionValue(certificate, Extension.cRLDistributionPoints.getId());
    } catch (IOException e) {
      obj = null;
    }
View Full Code Here

   * @param certificate the certificate
   * @return the URL or null
   * @throws IOException
   */
  public static String getOCSPURL(X509Certificate certificate) {
    ASN1Primitive obj;
    try {
      obj = getExtensionValue(certificate, Extension.authorityInfoAccess.getId());
          if (obj == null) {
              return null;
          }
          ASN1Sequence AccessDescriptions = (ASN1Sequence) obj;
          for (int i = 0; i < AccessDescriptions.size(); i++) {
            ASN1Sequence AccessDescription = (ASN1Sequence) AccessDescriptions.getObjectAt(i);
            if ( AccessDescription.size() != 2 ) {
              continue;
            }
            else if (AccessDescription.getObjectAt(0) instanceof ASN1ObjectIdentifier) {
              ASN1ObjectIdentifier id = (ASN1ObjectIdentifier)AccessDescription.getObjectAt(0);
              if (SecurityIDs.ID_OCSP.equals(id.getId())) {
                  ASN1Primitive description = (ASN1Primitive)AccessDescription.getObjectAt(1);
                      String AccessLocation =  getStringFromGeneralName(description);
                      if (AccessLocation == null) {
                          return "" ;
                      }
                      else {
View Full Code Here

   */
  public static String getTSAURL(X509Certificate certificate) {
      byte der[] = certificate.getExtensionValue(SecurityIDs.ID_TSA);
      if(der == null)
          return null;
      ASN1Primitive asn1obj;
    try {
      asn1obj = ASN1Primitive.fromByteArray(der);
          DEROctetString octets = (DEROctetString)asn1obj;
          asn1obj = ASN1Primitive.fromByteArray(octets.getOctets());
          ASN1Sequence asn1seq = ASN1Sequence.getInstance(asn1obj);
View Full Code Here

        PdfString contents = dic.getAsString(PdfName.CONTENTS);
        byte[] bc = contents.getOriginalBytes();
        byte[] bt = null;
        if (PdfName.ETSI_RFC3161.equals(PdfReader.getPdfObject(dic.get(PdfName.SUBFILTER)))) {
            ASN1InputStream din = new ASN1InputStream(new ByteArrayInputStream(bc));
            ASN1Primitive pkcs = din.readObject();
            bc = pkcs.getEncoded();
        }
        bt = hashBytesSha1(bc);
        return new PdfName(Utilities.convertToHex(bt));
    }
View Full Code Here

            ASN1InputStream din = new ASN1InputStream(new ByteArrayInputStream(contentsKey));

            //
            // Basic checks to make sure it's a PKCS#7 SignedData Object
            //
            ASN1Primitive pkcs;

            try {
                pkcs = din.readObject();
            }
            catch (IOException e) {
View Full Code Here

        PdfString contents = dic.getAsString(PdfName.CONTENTS);
        byte[] bc = contents.getOriginalBytes();
        byte[] bt = null;
        if (PdfName.ETSI_RFC3161.equals(PdfReader.getPdfObject(dic.get(PdfName.SUBFILTER)))) {
            ASN1InputStream din = new ASN1InputStream(new ByteArrayInputStream(bc));
            ASN1Primitive pkcs = din.readObject();
            bc = pkcs.getEncoded();
        }
        bt = hashBytesSha1(bc);
        return new PdfName(Utilities.convertToHex(bt));
    }
View Full Code Here

   * @return  the String where you can check if the certificate was revoked
   * @throws CertificateParsingException
   * @throws IOException
   */
  public static String getCRLURL(X509Certificate certificate) throws CertificateParsingException {
      ASN1Primitive obj;
    try {
      obj = getExtensionValue(certificate, Extension.cRLDistributionPoints.getId());
    } catch (IOException e) {
      obj = null;
    }
View Full Code Here

   * @param certificate the certificate
   * @return the URL or null
   * @throws IOException
   */
  public static String getOCSPURL(X509Certificate certificate) {
    ASN1Primitive obj;
    try {
      obj = getExtensionValue(certificate, Extension.authorityInfoAccess.getId());
          if (obj == null) {
              return null;
          }
          ASN1Sequence AccessDescriptions = (ASN1Sequence) obj;
          for (int i = 0; i < AccessDescriptions.size(); i++) {
            ASN1Sequence AccessDescription = (ASN1Sequence) AccessDescriptions.getObjectAt(i);
            if ( AccessDescription.size() != 2 ) {
              continue;
            }
            else if (AccessDescription.getObjectAt(0) instanceof ASN1ObjectIdentifier) {
              ASN1ObjectIdentifier id = (ASN1ObjectIdentifier)AccessDescription.getObjectAt(0);
              if (SecurityIDs.ID_OCSP.equals(id.getId())) {
                  ASN1Primitive description = (ASN1Primitive)AccessDescription.getObjectAt(1);
                      String AccessLocation =  getStringFromGeneralName(description);
                      if (AccessLocation == null) {
                          return "" ;
                      }
                      else {
View Full Code Here

TOP

Related Classes of org.bouncycastle.asn1.ASN1Primitive

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.