예제 #1
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");



            int nestedNodeCount = Asn1ReaderT.GetNestedNodeCount(asn1Reader);

            Storage.Put(Storage.CurrentContext, "nestedNodeCount", nestedNodeCount);

            bool isMovedNext = Asn1ReaderT.MoveNext(asn1Reader);

            if (isMovedNext)
            {
                Logger.writeLog("Moved Next on asn1Reader");
            }
            else
            {
                Logger.writeLog("Can not move next on asn1Reader");
            }
        }
예제 #2
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");
            Asn1ReaderT.LogCurrentNodeValues(asn1Reader, "Validity");

            /*
             * bool isMovedNext = Asn1ReaderT.MoveNext(asn1Reader);
             * if (isMovedNext)
             * {
             *  Logger.writeLog("Moved to StartDate");
             *  LogCurrentNodeValues(asn1Reader, "StartDate");
             *  isMovedNext = Asn1ReaderT.MoveNext(asn1Reader);
             *  if (isMovedNext)
             *  {
             *      Logger.writeLog("Moved to EndDate");
             *      LogCurrentNodeValues(asn1Reader, "EndDate");
             *  }
             *  else
             *  {
             *      Logger.writeLog("Can not move to EndDate");
             *  }
             * } else
             * {
             *  Logger.writeLog("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");

            Logger.writeLog("Getting Header");
            byte[] headerBytes = Asn1ReaderT.GetHeader(asn1Reader);
            Logger.writeLog("Retrieved Header");

            Logger.writeLog("Getting Payload");
            byte[] payloadBytes = Asn1ReaderT.GetPayload(asn1Reader);
            Logger.writeLog("Retrieved Payload");

            Logger.writeLog("Getting TagRawData");
            byte[] tagRawDataBytes = Asn1ReaderT.GetPayload(asn1Reader);
            Logger.writeLog("Retrieved TagRawData");

            Storage.Put(Storage.CurrentContext, "dataBytes", dataBytes);
            Storage.Put(Storage.CurrentContext, "Header", headerBytes);
            Storage.Put(Storage.CurrentContext, "Payload", payloadBytes);
            Storage.Put(Storage.CurrentContext, "TagRawData", tagRawDataBytes);

            int nestedNodeCount = Asn1ReaderT.GetNestedNodeCount(asn1Reader);

            Storage.Put(Storage.CurrentContext, "nestedNodeCount", nestedNodeCount);
        }
예제 #4
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 = Asn1ReaderT.ParseFromRawData(dataBytes);

            Asn1Logger.LogCurrentNodeValues(asn1Reader, "Validity");

            bool isMovedNext = Asn1ReaderT.MoveNext(asn1Reader);

            if (isMovedNext)
            {
                Asn1Logger.LogCurrentNodeValues(asn1Reader, "StartDate");
                isMovedNext = Asn1ReaderT.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");
            }
        }
예제 #5
0
 public static void LogCurrentNodeValues(Asn1Reader asn1Reader, string nodeName)
 {
     byte[] headerBytes     = Asn1ReaderT.GetHeader(asn1Reader);
     byte[] payloadBytes    = Asn1ReaderT.GetPayload(asn1Reader);
     byte[] tagRawDataBytes = Asn1ReaderT.GetPayload(asn1Reader);
     Storage.Put(Storage.CurrentContext, "Header", headerBytes);
     Storage.Put(Storage.CurrentContext, "Payload", payloadBytes);
     Storage.Put(Storage.CurrentContext, "TagRawData", tagRawDataBytes);
 }
예제 #6
0
        public static void LogCurrentNodeValues(Asn1Reader asn1Reader, string nodeName)
        {
            byte[] headerBytes     = Asn1ReaderT.GetHeader(asn1Reader);
            byte[] payloadBytes    = Asn1ReaderT.GetPayload(asn1Reader);
            byte[] tagRawDataBytes = Asn1ReaderT.GetTagRawData(asn1Reader);
            int    nestedNodeCount = Asn1ReaderT.GetNestedNodeCount(asn1Reader);

            Storage.Put(Storage.CurrentContext, "[" + nodeName + "]-Header :", headerBytes);
            Storage.Put(Storage.CurrentContext, "[" + nodeName + "]-Payload :", payloadBytes);
            Storage.Put(Storage.CurrentContext, "[" + nodeName + "]-TagRawData :", tagRawDataBytes);
            Storage.Put(Storage.CurrentContext, "[" + nodeName + "]-NestedNodeCount :", nestedNodeCount);
        }
예제 #7
0
        public static void Main()
        {
            Logger.writeLog("Start - Main() method");
            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 };
            Asn1Reader asn1Reader = Asn1ReaderT.FromRawData(dataBytes);

            byte[] headerBytes     = Asn1ReaderT.GetHeader(asn1Reader);
            byte[] payloadBytes    = Asn1ReaderT.GetPayload(asn1Reader);
            byte[] tagRawDataBytes = Asn1ReaderT.GetPayload(asn1Reader);

            Storage.Put(Storage.CurrentContext, "dataBytes", dataBytes);
            Storage.Put(Storage.CurrentContext, "Header", headerBytes);
            Storage.Put(Storage.CurrentContext, "Payload", payloadBytes);
            Storage.Put(Storage.CurrentContext, "TagRawData", tagRawDataBytes);
            Logger.writeLog("End - Main() method");

            int nestedNodeCount = Asn1Reader.GetNestedNodeCount(asn1Reader);

            Storage.Put(Storage.CurrentContext, "nestedNodeCount", nestedNodeCount);
            // return dataBytes;AsnInternalMap
        }