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); }
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); }
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); }