Package codec.asn1

Examples of codec.asn1.ASN1ObjectIdentifier


  Attribute attrUserFn = null;
  Attribute attrUserKeyId = null;

  // Add friendlyName (if present)
  if ((user_fn != null) && !user_fn.equals("")) {
      ASN1ObjectIdentifier fnOID = new ASN1ObjectIdentifier(FN_OID_);
      attrUserFn = new Attribute(fnOID, new ASN1BMPString(user_fn));
  }

  // add localKeyId (if present)
  if ((lk_id != null) && (lk_id.length > 0)) {
      ASN1ObjectIdentifier lkOID = new ASN1ObjectIdentifier(LK_OID_);
      attrUserKeyId = new Attribute(lkOID, new ASN1OctetString(lk_id));
  }

  // both present -> add both
  if ((user_fn != null) && (lk_id != null)) {
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

     * is used for this.
     */
    public Attribute() {
  super(2);

  type_ = new ASN1ObjectIdentifier();
  values_ = new ASN1SetOf(ASN1OpenType.class);

  add(type_);
  add(values_);
    }
View Full Code Here

  super(2);

  if (registry == null) {
      registry = OIDRegistry.getGlobalOIDRegistry();
  }
  type_ = new ASN1ObjectIdentifier();
  values_ = new ASN1SetOf(new DefinedByResolver(registry, type_));

  add(type_);
  add(values_);
    }
View Full Code Here

  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

TOP

Related Classes of codec.asn1.ASN1ObjectIdentifier

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.