C# Class MimeKit.Cryptography.X509CertificateDatabase

An X.509 certificate database.
Inheritance: IDisposable, IX509Store
ファイルを表示 Open project: nachocove/MimeKit Class Usage Examples

Public Methods

Method Description
Add ( X509CertificateRecord record ) : void

Add the specified certificate record.

Adds the specified certificate record to the database.

Add ( X509CrlRecord record ) : void

Add the specified CRL record.

Adds the specified CRL record to the database.

Dispose ( ) : void

Releases all resource used by the MimeKit.Cryptography.X509CertificateDatabase object.

Call Dispose() when you are finished using the MimeKit.Cryptography.X509CertificateDatabase. The Dispose() method leaves the MimeKit.Cryptography.X509CertificateDatabase in an unusable state. After calling Dispose(), you must release all references to the MimeKit.Cryptography.X509CertificateDatabase so the garbage collector can reclaim the memory that the MimeKit.Cryptography.X509CertificateDatabase was occupying.

Find ( IX509Selector selector, bool trustedOnly, X509CertificateRecordFields fields ) : IEnumerable

Finds the certificate records matching the specified selector.

Searches the database for certificate records matching the selector, returning all of the matching records populated with the desired fields.

Find ( MailboxAddress mailbox, System.DateTime now, bool requirePrivateKey, X509CertificateRecordFields fields ) : IEnumerable

Finds the certificate records for the specified mailbox.

Searches the database for certificates matching the specified mailbox that are valid for the date and time specified, returning all matching records populated with the desired fields.

Find ( Org.BouncyCastle.Asn1.X509.X509Name issuer, X509CrlRecordFields fields ) : IEnumerable

Finds the CRL records for the specified issuer.

Searches the database for CRL records matching the specified issuer, returning all matching records populated with the desired fields.

Find ( X509Certificate certificate, X509CertificateRecordFields fields ) : X509CertificateRecord

Find the specified certificate.

Searches the database for the specified certificate, returning the matching record with the desired fields populated.

Find ( X509Crl crl, X509CrlRecordFields fields ) : X509CrlRecord

Finds the specified certificate revocation list.

Searches the database for the specified CRL, returning the matching record with the desired fields populated.

FindCertificates ( IX509Selector selector ) : IEnumerable

Finds the certificates matching the specified selector.

Searches the database for certificates matching the selector, returning all matching certificates.

FindPrivateKeys ( IX509Selector selector ) : IEnumerable

Finds the private keys matching the specified selector.

Searches the database for certificate records matching the selector, returning the private keys for each matching record.

GetCrlStore ( ) : IX509Store

Gets a certificate revocation list store.

Gets a certificate revocation list store.

Remove ( X509CertificateRecord record ) : void

Remove the specified certificate record.

Removes the specified certificate record from the database.

Remove ( X509CrlRecord record ) : void

Remove the specified CRL record.

Removes the specified CRL record from the database.

Update ( X509CertificateRecord record, X509CertificateRecordFields fields ) : void

Update the specified certificate record.

Updates the specified fields of the record in the database.

Update ( X509CrlRecord record ) : void

Update the specified CRL record.

Updates the specified fields of the record in the database.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the X509CertificateDatabase and optionally releases the managed resources.

Releases the unmanaged resources used by the X509CertificateDatabase and optionally releases the managed resources.

GetColumnNames ( X509CertificateRecordFields fields ) : string[]

Gets the column names for the specified fields.

Gets the column names for the specified fields.

GetColumnNames ( X509CrlRecordFields fields ) : string[]

Gets the column names for the specified fields.

Gets the column names for the specified fields.

GetDeleteCommand ( X509CertificateRecord record ) : DbCommand

Gets the database command to delete the specified certificate record.

Gets the database command to delete the specified certificate record.

GetDeleteCommand ( X509CrlRecord record ) : DbCommand

Gets the database command to delete the specified CRL record.

Gets the database command to delete the specified CRL record.

GetInsertCommand ( X509CertificateRecord record ) : DbCommand

Gets the database command to insert the specified certificate record.

Gets the database command to insert the specified certificate record.

GetInsertCommand ( X509CrlRecord record ) : DbCommand

Gets the database command to insert the specified CRL record.

Gets the database command to insert the specified CRL record.

GetSelectAllCrlsCommand ( ) : DbCommand

Gets the database command to select all CRLs in the table.

Gets the database command to select all CRLs in the table.

GetSelectCommand ( IX509Selector selector, bool trustedOnly, bool requirePrivateKey, X509CertificateRecordFields fields ) : DbCommand

Gets the database command to select certificate records matching the specified selector.

Gets the database command to select certificate records matching the specified selector.

GetSelectCommand ( MailboxAddress mailbox, System.DateTime now, bool requirePrivateKey, X509CertificateRecordFields fields ) : DbCommand

Gets the database command to select the certificate records for the specified mailbox.

Gets the database command to select the certificate records for the specified mailbox.

GetSelectCommand ( X509Certificate certificate, X509CertificateRecordFields fields ) : DbCommand

Gets the database command to select the record matching the specified certificate.

Gets the database command to select the record matching the specified certificate.

GetSelectCommand ( X509Crl crl, X509CrlRecordFields fields ) : DbCommand

Gets the database command to select the record for the specified CRL.

Gets the database command to select the record for the specified CRL.

GetSelectCommand ( Org.BouncyCastle.Asn1.X509.X509Name issuer, X509CrlRecordFields fields ) : DbCommand

Gets the database command to select the CRL records matching the specified issuer.

Gets the database command to select the CRL records matching the specified issuer.

GetUpdateCommand ( X509CertificateRecord record, X509CertificateRecordFields fields ) : DbCommand

Gets the database command to update the specified record.

Gets the database command to update the specified record.

GetUpdateCommand ( X509CrlRecord record ) : DbCommand

Gets the database command to update the specified CRL record.

Gets the database command to update the specified CRL record.

GetValue ( X509CertificateRecord record, string columnName ) : object

Gets the value for the specified column.

Gets the value for the specified column.

GetValue ( X509CrlRecord record, string columnName ) : object

Gets the value for the specified column.

Gets the value for the specified column.

X509CertificateDatabase ( string password ) : System

Initializes a new instance of the MimeKit.Cryptography.X509CertificateDatabase class.

The password is used to encrypt and decrypt private keys in the database and cannot be null.

Private Methods

Method Description
DecodeCertificate ( DbDataReader reader, X509CertificateParser parser, int column, byte &buffer ) : X509Certificate
DecodeEncryptionAlgorithms ( DbDataReader reader, int column ) : EncryptionAlgorithm[]
DecodePrivateKey ( DbDataReader reader, int column, byte &buffer ) : AsymmetricKeyParameter
DecodeX509Crl ( DbDataReader reader, X509CrlParser parser, int column, byte &buffer ) : X509Crl
DecryptAsymmetricKeyParameter ( byte buffer, int length ) : AsymmetricKeyParameter
EncodeEncryptionAlgorithms ( EncryptionAlgorithm algorithms ) : string
EncodePrivateKey ( AsymmetricKeyParameter key ) : byte[]
EncryptAsymmetricKeyParameter ( AsymmetricKeyParameter key ) : byte[]
IX509Store ( IX509Selector selector ) : ICollection

Gets a collection of matching certificates matching the specified selector.

Gets a collection of matching certificates matching the specified selector.

LoadCertificateRecord ( DbDataReader reader, X509CertificateParser parser, byte &buffer ) : X509CertificateRecord
LoadCrlRecord ( DbDataReader reader, X509CrlParser parser, byte &buffer ) : X509CrlRecord
ReadBinaryBlob ( DbDataReader reader, int column, byte &buffer ) : int

Method Details

Add() public method

Add the specified certificate record.
Adds the specified certificate record to the database.
/// is null. ///
public Add ( X509CertificateRecord record ) : void
record X509CertificateRecord The certificate record.
return void

Add() public method

Add the specified CRL record.
Adds the specified CRL record to the database.
/// is null. ///
public Add ( X509CrlRecord record ) : void
record X509CrlRecord The CRL record.
return void

Dispose() public method

Releases all resource used by the MimeKit.Cryptography.X509CertificateDatabase object.
Call Dispose() when you are finished using the MimeKit.Cryptography.X509CertificateDatabase. The Dispose() method leaves the MimeKit.Cryptography.X509CertificateDatabase in an unusable state. After calling Dispose(), you must release all references to the MimeKit.Cryptography.X509CertificateDatabase so the garbage collector can reclaim the memory that the MimeKit.Cryptography.X509CertificateDatabase was occupying.
public Dispose ( ) : void
return void

Dispose() protected method

Releases the unmanaged resources used by the X509CertificateDatabase and optionally releases the managed resources.
Releases the unmanaged resources used by the X509CertificateDatabase and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; /// false to release only the unmanaged resources.
return void

Find() public method

Finds the certificate records matching the specified selector.
Searches the database for certificate records matching the selector, returning all of the matching records populated with the desired fields.
public Find ( IX509Selector selector, bool trustedOnly, X509CertificateRecordFields fields ) : IEnumerable
selector IX509Selector The match selector or null to match all certificates.
trustedOnly bool true if only trusted certificates should be returned.
fields X509CertificateRecordFields The desired fields.
return IEnumerable

Find() public method

Finds the certificate records for the specified mailbox.
Searches the database for certificates matching the specified mailbox that are valid for the date and time specified, returning all matching records populated with the desired fields.
/// is null. ///
public Find ( MailboxAddress mailbox, System.DateTime now, bool requirePrivateKey, X509CertificateRecordFields fields ) : IEnumerable
mailbox MailboxAddress The mailbox.
now System.DateTime The date and time.
requirePrivateKey bool true if a private key is required.
fields X509CertificateRecordFields The desired fields.
return IEnumerable

Find() public method

Finds the CRL records for the specified issuer.
Searches the database for CRL records matching the specified issuer, returning all matching records populated with the desired fields.
/// is null. ///
public Find ( Org.BouncyCastle.Asn1.X509.X509Name issuer, X509CrlRecordFields fields ) : IEnumerable
issuer Org.BouncyCastle.Asn1.X509.X509Name The issuer.
fields X509CrlRecordFields The desired fields.
return IEnumerable

Find() public method

Find the specified certificate.
Searches the database for the specified certificate, returning the matching record with the desired fields populated.
/// is null. ///
public Find ( X509Certificate certificate, X509CertificateRecordFields fields ) : X509CertificateRecord
certificate Org.BouncyCastle.X509.X509Certificate The certificate.
fields X509CertificateRecordFields The desired fields.
return X509CertificateRecord

Find() public method

Finds the specified certificate revocation list.
Searches the database for the specified CRL, returning the matching record with the desired fields populated.
/// is null. ///
public Find ( X509Crl crl, X509CrlRecordFields fields ) : X509CrlRecord
crl Org.BouncyCastle.X509.X509Crl The certificate revocation list.
fields X509CrlRecordFields The desired fields.
return X509CrlRecord

FindCertificates() public method

Finds the certificates matching the specified selector.
Searches the database for certificates matching the selector, returning all matching certificates.
public FindCertificates ( IX509Selector selector ) : IEnumerable
selector IX509Selector The match selector or null to return all certificates.
return IEnumerable

FindPrivateKeys() public method

Finds the private keys matching the specified selector.
Searches the database for certificate records matching the selector, returning the private keys for each matching record.
public FindPrivateKeys ( IX509Selector selector ) : IEnumerable
selector IX509Selector The match selector or null to return all private keys.
return IEnumerable

GetColumnNames() protected static method

Gets the column names for the specified fields.
Gets the column names for the specified fields.
protected static GetColumnNames ( X509CertificateRecordFields fields ) : string[]
fields X509CertificateRecordFields The fields.
return string[]

GetColumnNames() protected static method

Gets the column names for the specified fields.
Gets the column names for the specified fields.
protected static GetColumnNames ( X509CrlRecordFields fields ) : string[]
fields X509CrlRecordFields The fields.
return string[]

GetCrlStore() public method

Gets a certificate revocation list store.
Gets a certificate revocation list store.
public GetCrlStore ( ) : IX509Store
return IX509Store

GetDeleteCommand() protected abstract method

Gets the database command to delete the specified certificate record.
Gets the database command to delete the specified certificate record.
protected abstract GetDeleteCommand ( X509CertificateRecord record ) : DbCommand
record X509CertificateRecord The certificate record.
return DbCommand

GetDeleteCommand() protected abstract method

Gets the database command to delete the specified CRL record.
Gets the database command to delete the specified CRL record.
protected abstract GetDeleteCommand ( X509CrlRecord record ) : DbCommand
record X509CrlRecord The record.
return DbCommand

GetInsertCommand() protected abstract method

Gets the database command to insert the specified certificate record.
Gets the database command to insert the specified certificate record.
protected abstract GetInsertCommand ( X509CertificateRecord record ) : DbCommand
record X509CertificateRecord The certificate record.
return DbCommand

GetInsertCommand() protected abstract method

Gets the database command to insert the specified CRL record.
Gets the database command to insert the specified CRL record.
protected abstract GetInsertCommand ( X509CrlRecord record ) : DbCommand
record X509CrlRecord The CRL record.
return DbCommand

GetSelectAllCrlsCommand() protected abstract method

Gets the database command to select all CRLs in the table.
Gets the database command to select all CRLs in the table.
protected abstract GetSelectAllCrlsCommand ( ) : DbCommand
return DbCommand

GetSelectCommand() protected abstract method

Gets the database command to select certificate records matching the specified selector.
Gets the database command to select certificate records matching the specified selector.
protected abstract GetSelectCommand ( IX509Selector selector, bool trustedOnly, bool requirePrivateKey, X509CertificateRecordFields fields ) : DbCommand
selector IX509Selector Selector.
trustedOnly bool true if only trusted certificates should be matched.
requirePrivateKey bool true if the certificate must have a private key.
fields X509CertificateRecordFields The fields to return.
return DbCommand

GetSelectCommand() protected abstract method

Gets the database command to select the certificate records for the specified mailbox.
Gets the database command to select the certificate records for the specified mailbox.
protected abstract GetSelectCommand ( MailboxAddress mailbox, System.DateTime now, bool requirePrivateKey, X509CertificateRecordFields fields ) : DbCommand
mailbox MailboxAddress The mailbox.
now System.DateTime The date and time for which the certificate should be valid.
requirePrivateKey bool true if the certificate must have a private key.
fields X509CertificateRecordFields The fields to return.
return DbCommand

GetSelectCommand() protected abstract method

Gets the database command to select the record matching the specified certificate.
Gets the database command to select the record matching the specified certificate.
protected abstract GetSelectCommand ( X509Certificate certificate, X509CertificateRecordFields fields ) : DbCommand
certificate Org.BouncyCastle.X509.X509Certificate The certificate.
fields X509CertificateRecordFields The fields to return.
return DbCommand

GetSelectCommand() protected abstract method

Gets the database command to select the record for the specified CRL.
Gets the database command to select the record for the specified CRL.
protected abstract GetSelectCommand ( X509Crl crl, X509CrlRecordFields fields ) : DbCommand
crl Org.BouncyCastle.X509.X509Crl The X.509 CRL.
fields X509CrlRecordFields The fields to return.
return DbCommand

GetSelectCommand() protected abstract method

Gets the database command to select the CRL records matching the specified issuer.
Gets the database command to select the CRL records matching the specified issuer.
protected abstract GetSelectCommand ( Org.BouncyCastle.Asn1.X509.X509Name issuer, X509CrlRecordFields fields ) : DbCommand
issuer Org.BouncyCastle.Asn1.X509.X509Name The issuer.
fields X509CrlRecordFields The fields to return.
return DbCommand

GetUpdateCommand() protected abstract method

Gets the database command to update the specified record.
Gets the database command to update the specified record.
protected abstract GetUpdateCommand ( X509CertificateRecord record, X509CertificateRecordFields fields ) : DbCommand
record X509CertificateRecord The certificate record.
fields X509CertificateRecordFields The fields to update.
return DbCommand

GetUpdateCommand() protected abstract method

Gets the database command to update the specified CRL record.
Gets the database command to update the specified CRL record.
protected abstract GetUpdateCommand ( X509CrlRecord record ) : DbCommand
record X509CrlRecord The CRL record.
return DbCommand

GetValue() protected method

Gets the value for the specified column.
Gets the value for the specified column.
/// is not a known column name. ///
protected GetValue ( X509CertificateRecord record, string columnName ) : object
record X509CertificateRecord The certificate record.
columnName string The column name.
return object

GetValue() protected static method

Gets the value for the specified column.
Gets the value for the specified column.
/// is not a known column name. ///
protected static GetValue ( X509CrlRecord record, string columnName ) : object
record X509CrlRecord The CRL record.
columnName string The column name.
return object

Remove() public method

Remove the specified certificate record.
Removes the specified certificate record from the database.
/// is null. ///
public Remove ( X509CertificateRecord record ) : void
record X509CertificateRecord The certificate record.
return void

Remove() public method

Remove the specified CRL record.
Removes the specified CRL record from the database.
/// is null. ///
public Remove ( X509CrlRecord record ) : void
record X509CrlRecord The CRL record.
return void

Update() public method

Update the specified certificate record.
Updates the specified fields of the record in the database.
/// is null. ///
public Update ( X509CertificateRecord record, X509CertificateRecordFields fields ) : void
record X509CertificateRecord The certificate record.
fields X509CertificateRecordFields The fields to update.
return void

Update() public method

Update the specified CRL record.
Updates the specified fields of the record in the database.
/// is null. ///
public Update ( X509CrlRecord record ) : void
record X509CrlRecord The CRL record.
return void

X509CertificateDatabase() protected method

Initializes a new instance of the MimeKit.Cryptography.X509CertificateDatabase class.
The password is used to encrypt and decrypt private keys in the database and cannot be null.
/// is null. ///
protected X509CertificateDatabase ( string password ) : System
password string The password used for encrypting and decrypting the private keys.
return System