Package com.maverick.crypto.asn1

Examples of com.maverick.crypto.asn1.ASN1Null


    public static void main(String[] args) {

        TrustedCACertStore store = new TrustedCACertStore();

        DERInputStream der = null;
        InputStream in = null;
        try {
            in = new FileInputStream("c:\\exported.cer"); //$NON-NLS-1$
            der = new DERInputStream(in);

            ASN1Sequence certificate = (ASN1Sequence) der.readObject();
            com.maverick.crypto.asn1.x509.X509Certificate x509 = new com.maverick.crypto.asn1.x509.X509Certificate(X509CertificateStructure.getInstance(certificate));

            /*
             * if (store.isTrustedCertificate(x509, false, false)) {
             * //System.out.println("Success"); } else {
View Full Code Here


        return (X509Certificate) certificates.get(sig);
    }

    public void addTrustedCACertificate(InputStream in) {

        DERInputStream der = null;
        try {

            der = new DERInputStream(in);

            ASN1Sequence certificate = (ASN1Sequence) der.readObject();

            X509Certificate x509 = new X509Certificate(X509CertificateStructure.getInstance(certificate));

            if (certificates.containsKey(x509.getSubjectDN().toString())) {
                // #ifdef DEBUG
                if (log.isDebugEnabled())
                    log.debug(Messages.getString("CertificateStore.alreadyExists") + x509.getSubjectDN().toString()); //$NON-NLS-1$
                // #endif
            } else {
                // #ifdef DEBUG
                if (log.isDebugEnabled())
                    log.debug(MessageFormat.format(Messages.getString("CertificateStore.addingTrustedCA"), new Object[] { x509.getSubjectDN().toString() })); //$NON-NLS-1$
                // #endif
                certificates.put(x509.getSubjectDN().toString(), x509);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (IOException ex) {
            }
            try {
                if (der != null) {
                    der.close();
                }
            } catch (IOException ex) {
            }
        }
    }
View Full Code Here

            version = DERInteger.getInstance(seq.getObjectAt(0));
        }
        else
        {
            seqStart = -1;          // field 0 is missing!
            version = new DERInteger(0);
        }

        serialNumber = DERInteger.getInstance(seq.getObjectAt(seqStart + 1));

        signature = AlgorithmIdentifier.getInstance(seq.getObjectAt(seqStart + 2));
View Full Code Here

     */
    public DERObject getDERObject()
    {
        ASN1EncodableVector  v = new ASN1EncodableVector();

        v.add(new DERInteger(getModulus()));
        v.add(new DERInteger(getPublicExponent()));

        return new DERSequence(v);
    }
View Full Code Here

        int     pathLenConstraint)
    {
      if (cA )
      {
          this.cA = new DERBoolean(cA);
          this.pathLenConstraint = new DERInteger(pathLenConstraint);
      }
      else
      {
        this.cA = null;
        this.pathLenConstraint = null;
View Full Code Here

   */
  public BasicConstraints(
    int     pathLenConstraint)
  {
    this.cA = new DERBoolean(true);
    this.pathLenConstraint = new DERInteger(pathLenConstraint);
  }
View Full Code Here

        e = this.ordering.elements();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier     oid = (DERObjectIdentifier)e.nextElement();
            X509Extension           ext = (X509Extension)extensions.get(oid);

            this.extensions.put(oid, ext);
        }
    }
View Full Code Here

        ASN1EncodableVector     vec = new ASN1EncodableVector();
        Enumeration             e = ordering.elements();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier     oid = (DERObjectIdentifier)e.nextElement();
            X509Extension           ext = (X509Extension)extensions.get(oid);
            ASN1EncodableVector     v = new ASN1EncodableVector();

            v.add(oid);
View Full Code Here

            {
                Enumeration     e = extensions.oids();

                while (e.hasMoreElements())
                {
                    DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
                    X509Extension       ext = extensions.getExtension(oid);

                    if (ext.isCritical())
                    {
                        set.addElement(oid.getId());
                    }
                }

                X509Extension[] ext = new X509Extension[set.size()];
                set.copyInto(ext);
View Full Code Here

    {
        X509Extensions exts = c.getTBSCertificate().getExtensions();

        if (exts != null)
        {
            X509Extension   ext = exts.getExtension(new DERObjectIdentifier(oid));
            if (ext != null)
            {
                return ext.getValue().getOctets();
            }
        }
View Full Code Here

TOP

Related Classes of com.maverick.crypto.asn1.ASN1Null

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.