Exemple #1
0
        /// <summary>
        /// Converts a ASN.1 Encoded Variable to a System UInt32
        /// </summary>
        /// <returns>A System UInt32 from the Encoded Value</returns>
        public UInt32 ToUInt32()
        {
            List <byte> raw      = ToBytes();
            int         position = 0;

            return(BasicEncodingRules.DecodeUInteger32(ref raw, ref position));
        }
Exemple #2
0
 /// <summary>
 /// Converts a ASN.1 Encoded DateTime to a System DateTime
 /// </summary>
 /// <returns></returns>
 public DateTime ToDateTime()
 {
     try
     {
         List <byte> raw      = ToBytes();
         int         position = 0;
         uint        value    = BasicEncodingRules.DecodeUInteger32(ref raw, ref position, TypeCode);
         //use 1, 1, 0 until when we figure out why im 2 hrs off.
         return((new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).AddSeconds(value));
     }
     catch
     {
         //Maybe return Not a Date Time somehow?
         throw;
     }
 }