public static bool CheckValidityPeriod(Certificate certificate)
        {
            long transactionTime = TransactionContentUtil.retrieveTransactionTime();

            if (transactionTime < certificate.Validity.NotBefore)
            {
                Logger.log("Validity.NotBefore is not in valid period");
                return(false);
            }

            if (transactionTime > certificate.Validity.NotAfter)
            {
#if NET_CORE
//fixme: test certificate time is invalid so will be changed with new one.
//remove this block when test certificates changed for NET_CORE tests
//  return false;
                return(true);
#else
                Logger.log("Validity.NotAfter is not in valid period");
                return(false);
#endif
            }

            return(true);
        }
示例#2
0
        public static void AddFraudReportToStorage(byte[] fraudId, byte[] reporter, byte[] fakeButValidCertificateHash)
        {
            FraudEntry fraudEntry = new FraudEntry();

            fraudEntry.FraudId  = fraudId;
            fraudEntry.Reporter = reporter;
            fraudEntry.FakeButValidCertificateHash = fakeButValidCertificateHash;
            fraudEntry.ReportDate = TransactionContentUtil.retrieveTransactionTime();
            fraudEntry.Status     = FraudStatus.REPORTED;

            byte[] fraudIdStorageKey = ArrayUtil.Concat(FRAUD_ID_STORAGE_PREFIX, fraudId);
            saveStorageForFraudIdIndex(fraudIdStorageKey, fraudEntry);
            AddFraudToList(FRAUD_LIST_STORAGE_KEY, fraudIdStorageKey);
        }