Exemplo n.º 1
0
        public static long DecodeUTCTime(Byte[] rawData)
        {
            if (rawData == null)
            {
                Logger.writeLog("ERROR-raw data is null");
                return(-1);
            }
            Asn1Data asn1Data = Asn1Parser.ParseFromRawData(rawData);

            return((new Asn1UtcTime(asn)).Value);
        }
Exemplo n.º 2
0
        public static long DecodeDateTime(Byte[] rawData)
        {
            Asn1Data asn1Data = Asn1Parser.ParseFromRawData(rawData);

            switch (asn1Data.Tag)
            {
            case (Byte)Asn1Type.UTCTime: return(Asn1UtcTimeParser.Decode(rawData));

            case (Byte)Asn1Type.Generalizedtime: return(DecodeGeneralizedTime(rawData));

            default:
            {
                return(-1);
            }
            }
        }
Exemplo n.º 3
0
        public static byte[] DecodeDateTime(Byte[] rawData)
        {
            Asn1Data asn1Data = Asn1Parser.ParseFromRawData(rawData);

            switch (asn1Data.Tag)
            {
            case (Byte)Asn1Type.UTCTime:
                return(Asn1UtcTimeParser.Decode(rawData));

            case (Byte)Asn1Type.Generalizedtime:
                return(Asn1GeneralizedTimeParser.Decode(rawData));

            default:
            {
                //todo: Handle exceptions
                return(null);
            }
            }
        }
Exemplo n.º 4
0
 static void Init(Asn1Data asn1Data, Asn1GeneralizedTime asn1GeneralizedTime)
 {
     asn1GeneralizedTime.Tag     = asn1Data.Tag;
     asn1GeneralizedTime.TagName = asn1Data.TagName;
     asn1GeneralizedTime.RawData = Asn1Parser.GetTagRawData(asn1Data);
 }