示例#1
0
        internal static DerObjectIdentifier FromOctetString(byte[] enc)
        {
            OidHandle hdl = new OidHandle(enc);

            lock (pool)
            {
                DerObjectIdentifier oid = (DerObjectIdentifier)pool[hdl];
                if (oid != null)
                {
                    return(oid);
                }
            }

            return(new DerObjectIdentifier(enc));
        }
示例#2
0
        /**
         * Intern will return a reference to a pooled version of this object, unless it
         * is not present in which case intern will add it.
         * <p>
         * The pool is also used by the ASN.1 parsers to limit the number of duplicated OID
         * objects in circulation.
         * </p>
         * @return a reference to the identifier in the pool.
         */
        public DerObjectIdentifier Intern()
        {
            lock (pool)
            {
                OidHandle           hdl = new OidHandle(GetBody());
                DerObjectIdentifier oid = (DerObjectIdentifier)pool[hdl];

                if (oid != null)
                {
                    return(oid);
                }
                else
                {
                    pool.Add(hdl, this);
                    return(this);
                }
            }
        }