/// <summary> /// Initializes a new instance of the <see cref="MimeKit.Cryptography.DefaultSecureMimeContext"/> class. /// </summary> /// <remarks> /// Allows the program to specify its own location for the SQLite database. If the file does not exist, /// it will be created and the necessary tables and indexes will be constructed. /// </remarks> /// <param name="fileName">The path to the SQLite database.</param> /// <param name="password">The password used for encrypting and decrypting the private keys.</param> /// <exception cref="System.ArgumentNullException"> /// <para><paramref name="fileName"/> is <c>null</c>.</para> /// <para>-or-</para> /// <para><paramref name="password"/> is <c>null</c>.</para> /// </exception> /// <exception cref="System.ArgumentException"> /// The specified file path is empty. /// </exception> /// <exception cref="System.UnauthorizedAccessException"> /// The user does not have access to read the specified file. /// </exception> /// <exception cref="System.IO.IOException"> /// An error occurred reading the file. /// </exception> public DefaultSecureMimeContext(string fileName, string password) { if (fileName == null) throw new ArgumentNullException ("fileName"); if (password == null) throw new ArgumentNullException ("password"); var dir = Path.GetDirectoryName (fileName); var exists = File.Exists (fileName); if (!string.IsNullOrEmpty (dir) && !Directory.Exists (dir)) Directory.CreateDirectory (dir); dbase = new X509CertificateDatabase (fileName, password); if (!exists) { // TODO: initialize our dbase with some root CA certificates. } }