Package codec.asn1

Examples of codec.asn1.ASN1TagComparator


  try {
      reg = PKCS12OIDRegistry.getDefaultRegistry();

      for (n = 0; n < argv.length; n++) {
    System.out.println(reg.getASN1Type(new ASN1ObjectIdentifier(
      argv[n])));
      }
  } catch (Exception e) {
      e.printStackTrace(System.err);
  }
View Full Code Here


     * A SafeContents can be put recursively into a SafeBag.
     *
     * @return the OID defining this structure as a SafeContents bag.
     */
    public ASN1ObjectIdentifier getOID() {
  return new ASN1ObjectIdentifier(OID_);
    }
View Full Code Here

  try {
      reg = PKCSRegistry.getDefaultRegistry();

      for (n = 0; n < argv.length; n++) {
    System.out.println(reg.getASN1Type(new ASN1ObjectIdentifier(
      argv[n])));
      }
  } catch (Exception e) {
      e.printStackTrace(System.err);
  }
View Full Code Here

     *
     * @return true if oid is a valid codec.asn1.ASN1ObjectIdentifier
     */
    public static boolean isObjectIdentifier(String oid)
    {
        ASN1ObjectIdentifier aSN1ObjectIdentifier = null;
        try
        {
            aSN1ObjectIdentifier = new ASN1ObjectIdentifier(oid);
        }
        catch (Exception e)
        {
            return false;
        }
View Full Code Here

     */
    private static String lookupClassname(
        String moduleOID,
        String typereference)
    {
        ASN1ObjectIdentifier aSN1ObjectIdentifier =
            new ASN1ObjectIdentifier(moduleOID.trim());
        Hashtable moduleDefinition                =
            (Hashtable)modules.get(aSN1ObjectIdentifier);

        if (moduleDefinition == null)
        {
View Full Code Here

     * Loads all property files of the form 'oid*.map' from the given path.
     * @param path relative to classpath e.g. 'codec/asn1'
     */
    public static void loadOIDMap(String path)
    {
        ASN1ObjectIdentifier oid;
        InputStream in;
        Properties props;
        Map.Entry entry;
        Iterator i;
        String key;
        int n;

        if (path == null)
        {
            throw new NullPointerException("path");
        }

        n      = 0;
        in     = ClassLoader.getSystemResourceAsStream(path + "/oid0.map");

        // trying different loaders and paths
        if (in == null)
        {
            in = Repository.class.getResourceAsStream(path + "/oid0.map");

            if (in == null)
            {
                in = Repository.class.getResourceAsStream(
                        "/" + path + "/oid0.map");

                if (in == null)
                {
                    log.error("Warning: could not get resource at " + path);
                }
            }
        }

        while (in != null)
        {
            try
            {
                props = new Properties();
                props.load(in);

                for (i = props.entrySet().iterator(); i.hasNext();)
                {
                    entry     = (Map.Entry)i.next();
                    key       = (String)entry.getKey();

                    String classname = (String)entry.getValue();
                    String typereference = null;

                    int indexOfSemicolon = key.indexOf(';');
                    if (indexOfSemicolon != -1)
                    {
                        typereference     = key.substring(
                                indexOfSemicolon + 1);
                        key               = key.substring(
                                0,
                                indexOfSemicolon);
                    }
                    oid = new ASN1ObjectIdentifier(key.trim());

                    // oid to class mapping
                    map.put(oid, classname);
                    log.debug("map '" + key + "' -> '" + classname + "'");
                    if (typereference != null)
                    {
                        // module + typereference to class mapping
                        key     = key.substring(0, key.lastIndexOf('.'));
                        oid     = new ASN1ObjectIdentifier(key.trim());

                        Hashtable module = null;

                        if (modules.containsKey(oid))
                        {
View Full Code Here

    /**
     *
     */
    public SecretBag() {
  super(2);
  ASN1ObjectIdentifier secretTypeId = new ASN1ObjectIdentifier();
  ASN1OpenType ot = new ASN1OpenType(reg_, secretTypeId);
  secretValue_ = new ASN1TaggedType(0, ot, true);
    }
View Full Code Here

     * Returns the OID for this structure.
     *
     * @return the OID
     */
    public ASN1ObjectIdentifier getOID() {
  return new ASN1ObjectIdentifier(OID_);
    }
View Full Code Here

    /**
     * The default constructor.
     */
    public CertBag() {
  super(2);
  certId_ = new ASN1ObjectIdentifier();
  add(certId_);
  ASN1OpenType ot = new ASN1OpenType(reg_, certId_);
  certValue_ = new ASN1TaggedType(0, ot, true);
  add(certValue_);
    }
View Full Code Here

     *                the certicifate
     */
    public CertBag(java.security.cert.X509Certificate cert)
      throws java.security.cert.CertificateEncodingException {
  super(2);
  certId_ = new ASN1ObjectIdentifier("1.2.840.113549.1.9.22.1");
  add(certId_);
  x509Cert_ = new ASN1OctetString(cert.getEncoded());
  certValue_ = new ASN1TaggedType(0, x509Cert_, true);
  add(certValue_);
    }
View Full Code Here

TOP

Related Classes of codec.asn1.ASN1TagComparator

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.