Пример #1
0
        public static void Main()
        {
            byte[] dataBytes = new byte[] { 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x32, 0x30, 0x34, 0x32, 0x37, 0x31, 0x30, 0x33, 0x31, 0x31, 0x38, 0x5A, 0x17, 0x0D, 0x32, 0x32, 0x30, 0x34, 0x32, 0x35, 0x31, 0x30, 0x33, 0x31, 0x31, 0x38, 0x5A };
            Asn1Logger.LogByteArray("Encoded Validity: ", dataBytes);

            Asn1Data asn1Data = Asn1Parser.ParseFromRawData(dataBytes);

            bool isMovedNext = Asn1Parser.MoveNext(asn1Data);

            if (isMovedNext)
            {
                // byte[] notBeforeByte = Asn1Utils.DecodeDateTime(asn1Data);
                Asn1Logger.LogCurrentNodeValues(asn1Data, "notBefore");
                // Asn1Logger.LogByteArray("Validity-NotBefore: ", notBeforeByte);
                isMovedNext = Asn1Parser.MoveNext(asn1Data);
                if (isMovedNext)
                {
                    //  byte[] notAfterByte = Asn1Utils.DecodeDateTime(asn1Data);
                    Asn1Logger.LogCurrentNodeValues(asn1Data, "notAfter");
                    //Asn1Logger.LogByteArray("Validity-NotAfter: ", notAfterByte);
                }
                else
                {
                    Logger.writeLog("ERROR-Can not move to EndDate");
                }
            }
            else
            {
                Logger.writeLog("ERROR-Can not move to StartDate");
            }
        }
Пример #2
0
        public static void Main()
        {
            byte[]   dataBytes  = new byte[] { 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x32, 0x30, 0x34, 0x32, 0x37, 0x31, 0x30, 0x33, 0x31, 0x31, 0x38, 0x5A, 0x17, 0x0D, 0x32, 0x32, 0x30, 0x34, 0x32, 0x35, 0x31, 0x30, 0x33, 0x31, 0x31, 0x38, 0x5A };
            Asn1Data asn1Reader = Asn1Parser.ParseFromRawData(dataBytes);

            Asn1Logger.LogCurrentNodeValues(asn1Reader, "Validity");

            bool isMovedNext = Asn1Parser.MoveNext(asn1Reader);

            if (isMovedNext)
            {
                Asn1Logger.LogCurrentNodeValues(asn1Reader, "StartDate");
                isMovedNext = Asn1Parser.MoveNext(asn1Reader);
                if (isMovedNext)
                {
                    Asn1Logger.LogCurrentNodeValues(asn1Reader, "EndDate");
                }
                else
                {
                    Logger.writeLog("ERROR-Can not move to EndDate");
                }
            }
            else
            {
                Logger.writeLog("ERROR-Can not move to StartDate");
            }
        }
Пример #3
0
        public static void Main()
        {
            Logger.writeLog("Starting Smart Contract Main -->");
            byte[] dataBytes = new byte[] { 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x32, 0x30, 0x34, 0x32, 0x37, 0x31, 0x30, 0x33, 0x31, 0x31, 0x38, 0x5A, 0x17, 0x0D, 0x32, 0x32, 0x30, 0x34, 0x32, 0x35, 0x31, 0x30, 0x33, 0x31, 0x31, 0x38, 0x5A };
            Logger.writeLog("Constructing asn1Reader class");
            Asn1Reader asn1Reader = Asn1ReaderT.FromRawData(dataBytes);

            Logger.writeLog("Constructed asn1Reader class");
            Asn1Logger.LogCurrentNodeValues(asn1Reader, "Validity");

            bool isMovedNext = Asn1ReaderT.MoveNext(asn1Reader);

            if (isMovedNext)
            {
                Logger.writeLog("Moved to StartDate");
                Asn1Logger.LogCurrentNodeValues(asn1Reader, "StartDate");
                isMovedNext = Asn1ReaderT.MoveNext(asn1Reader);
                if (isMovedNext)
                {
                    Logger.writeLog("Moved to EndDate");
                    Asn1Logger.LogCurrentNodeValues(asn1Reader, "EndDate");
                }
                else
                {
                    Logger.writeLog("Can not move to EndDate");
                }
            }
            else
            {
                Logger.writeLog("Can not move to StartDate");
            }
        }