Example #1
0
        public static byte[] getName(Oid oid)
        {
            MemoryStream ret1 = new MemoryStream();

            MyOid.Encode(ret1, oid.Value);

            byte[] ret = new byte[ret1.Length];
            ret1.Position = 0;
            ret1.Read(ret, 0, (int)ret1.Length);
            return(ret);
        }
Example #2
0
 public static void Encode(Stream bt, string oidStr)
 {
     string[] strArray = oidStr.Split(new char[] { '.' });
     if (strArray.Length < 2)
     {
         throw new Exception("Invalid OID string.");
     }
     ulong[] numArray = new ulong[strArray.Length];
     for (int i = 0; i < strArray.Length; i++)
     {
         numArray[i] = Convert.ToUInt64(strArray[i]);
     }
     bt.WriteByte((byte)((numArray[0] * ((ulong)40L)) + numArray[1]));
     for (int j = 2; j < numArray.Length; j++)
     {
         MyOid.EncodeValue(bt, numArray[j]);
     }
 }
Example #3
0
 public void setValue(Oid d)
 {
     data = MyOid.getName(d);
 }