示例#1
0
        public static void AddEndEntityCertificateToStorage(Certificate certificate, byte[] certificateHash,
                                                            byte[] encodedCert)
        {
            EndEntityCertificateEntry endEntityCertificateEntry = new EndEntityCertificateEntry();

            endEntityCertificateEntry.CertificateValue = encodedCert;
            endEntityCertificateEntry.IsRevoked        = false;
            byte[] endEntityCertificateEntrySerialized = SerializationUtil.Serialize(endEntityCertificateEntry);
            StorageUtil.saveToStorage(certificateHash, endEntityCertificateEntrySerialized);

            AddCertificateToCaIssuedCertificateList(certificate, certificateHash);
            AddCertificateToDomainCertificateList(certificate, certificateHash);
        }
示例#2
0
        public static EndEntityCertificateEntry RetrieveEndEntityCertificateFromStorage(byte[] certificateHash)
        {
            byte[] endEntityCertificateEntrySerialized = StorageUtil.readFromStorage(certificateHash);
            if (endEntityCertificateEntrySerialized == null)
            {
                Logger.log("Can not find end entity certificate in storage");
                return(new EndEntityCertificateEntry());
            }

            EndEntityCertificateEntry entityCertificateEntry =
                (EndEntityCertificateEntry)SerializationUtil.Deserialize(endEntityCertificateEntrySerialized);

            return(entityCertificateEntry);
        }
示例#3
0
        public static bool MarkEndEntityCertificateRevokedInStorage(byte[] certificateHash)
        {
            byte[] endEntityCertificateEntrySerialized = StorageUtil.readFromStorage(certificateHash);
            if (endEntityCertificateEntrySerialized == null)
            {
                Logger.log("Can not find end entity certificate in storage");
                return(false);
            }

            EndEntityCertificateEntry entityCertificateEntry =
                (EndEntityCertificateEntry)SerializationUtil.Deserialize(endEntityCertificateEntrySerialized);

            entityCertificateEntry.IsRevoked = true;

            endEntityCertificateEntrySerialized = SerializationUtil.Serialize(entityCertificateEntry);
            StorageUtil.saveToStorage(certificateHash, endEntityCertificateEntrySerialized);
            return(true);
        }