Opc.Ua.DirectoryCertificateStore.DeleteCRL C# (CSharp) Method

DeleteCRL() public method

Removes a CRL from the store.
public DeleteCRL ( X509CRL crl ) : bool
crl X509CRL
return bool
        public bool DeleteCRL(X509CRL crl)
        {
            if (crl == null)
            {
                throw new ArgumentNullException("crl");
            }

            string filePath = m_directory.FullName;
            filePath += Path.DirectorySeparatorChar + "crl";

            DirectoryInfo dirInfo = new DirectoryInfo(filePath);

            if (dirInfo.Exists)
            {
                foreach (FileInfo fileInfo in dirInfo.GetFiles("*.crl"))
                {
                    if (fileInfo.Length == crl.RawData.Length)
                    {
                        byte[] bytes = File.ReadAllBytes(fileInfo.FullName);

                        if (Utils.IsEqual(bytes, crl.RawData))
                        {
                            fileInfo.Delete();
                            return true;
                        }
                    }
                }
            }

            return false;
        }
#endregion