Click or drag to resize
MimeKit

OpenPgpContext Class

An abstract OpenPGP cryptography context which can be used for PGP/MIME.
Inheritance Hierarchy

Namespace:  MimeKit.Cryptography
Assembly:  MimeKit (in MimeKit.dll) Version: 3.0.0
Syntax
C#
public abstract class OpenPgpContext : CryptographyContext

The OpenPgpContext type exposes the following members.

Constructors
  NameDescription
Protected methodOpenPgpContext
Initialize a new instance of the OpenPgpContext class.
Top
Properties
  NameDescription
Public propertyAutoKeyRetrieve
Get or set whether unknown PGP keys should automtically be retrieved.
Public propertyDefaultEncryptionAlgorithm
Get or set the default encryption algorithm.
Protected propertyDigestAlgorithmRank
Get the preferred rank order for the digest algorithms; from the most preferred to the least.
(Inherited from CryptographyContext.)
Public propertyEnabledDigestAlgorithms
Get the enabled digest algorithms in ranked order.
(Inherited from CryptographyContext.)
Public propertyEnabledEncryptionAlgorithms
Get the enabled encryption algorithms in ranked order.
(Inherited from CryptographyContext.)
Protected propertyEncryptionAlgorithmRank
Get the preferred rank order for the encryption algorithms; from the most preferred to the least.
(Inherited from CryptographyContext.)
Public propertyEncryptionProtocol
Get the encryption protocol.
(Overrides CryptographyContextEncryptionProtocol.)
Public propertyKeyExchangeProtocol
Get the key exchange protocol.
(Overrides CryptographyContextKeyExchangeProtocol.)
Public propertyKeyServer
Get or set the key server to use when automatically retrieving keys.
Public propertyPrepareBeforeSigning
Get or set whether MimeEntitys should be prepared before signing.
(Inherited from CryptographyContext.)
Public propertySignatureProtocol
Get the signature protocol.
(Overrides CryptographyContextSignatureProtocol.)
Top
Methods
  NameDescription
Public methodCanEncrypt
Check whether or not the cryptography context can encrypt to a particular recipient.
(Inherited from CryptographyContext.)
Public methodCanEncryptAsync
Asynchronously check whether or not the cryptography context can encrypt to a particular recipient.
(Inherited from CryptographyContext.)
Public methodCanSign
Check whether or not a particular mailbox address can be used for signing.
(Inherited from CryptographyContext.)
Public methodCanSignAsync
Asynchronously check whether or not a particular mailbox address can be used for signing.
(Inherited from CryptographyContext.)
Public methodDecrypt(Stream, CancellationToken)
Decrypt the specified encryptedData.
(Overrides CryptographyContextDecrypt(Stream, CancellationToken).)
Public methodDecrypt(Stream, DigitalSignatureCollection, CancellationToken)
Decrypt the specified encryptedData and extracts the digital signers if the content was also signed.
Public methodDecryptAsync
Asynchronously decrypt the specified encryptedData.
(Overrides CryptographyContextDecryptAsync(Stream, CancellationToken).)
Public methodDecryptTo
Decrypt an encrypted stream and extract the digital signers if the content was also signed.
Public methodDecryptToAsync
Asynchronously decrypt an encrypted stream and extract the digital signers if the content was also signed.
Public methodDisable(DigestAlgorithm)
Disable the digest algorithm.
(Inherited from CryptographyContext.)
Public methodDisable(EncryptionAlgorithm)
Disable the encryption algorithm.
(Inherited from CryptographyContext.)
Public methodDispose
Releases all resources used by the CryptographyContext object.
(Inherited from CryptographyContext.)
Protected methodDispose(Boolean)
Releases all resources used by the OpenPgpContext object.
(Overrides CryptographyContextDispose(Boolean).)
Public methodEnable(DigestAlgorithm)
Enable the digest algorithm.
(Inherited from CryptographyContext.)
Public methodEnable(EncryptionAlgorithm)
Enable the encryption algorithm.
(Inherited from CryptographyContext.)
Public methodEncrypt(IEnumerableMailboxAddress, Stream, CancellationToken)
Encrypt the specified content for the specified recipients.
(Overrides CryptographyContextEncrypt(IEnumerableMailboxAddress, Stream, CancellationToken).)
Public methodEncrypt(IEnumerablePgpPublicKey, Stream, CancellationToken)
Encrypt the specified content for the specified recipients.
Public methodEncrypt(EncryptionAlgorithm, IEnumerableMailboxAddress, Stream, CancellationToken)
Encrypt the specified content for the specified recipients.
Public methodEncrypt(EncryptionAlgorithm, IEnumerablePgpPublicKey, Stream, CancellationToken)
Encrypt the specified content for the specified recipients.
Public methodEncryptAsync(IEnumerableMailboxAddress, Stream, CancellationToken)
Asynchronously encrypt the specified content for the specified recipients.
(Overrides CryptographyContextEncryptAsync(IEnumerableMailboxAddress, Stream, CancellationToken).)
Public methodEncryptAsync(IEnumerablePgpPublicKey, Stream, CancellationToken)
Asynchronously encrypt the specified content for the specified recipients.
Public methodEncryptAsync(EncryptionAlgorithm, IEnumerableMailboxAddress, Stream, CancellationToken)
Asynchronously encrypt the specified content for the specified recipients.
Public methodEncryptAsync(EncryptionAlgorithm, IEnumerablePgpPublicKey, Stream, CancellationToken)
Asynchronously encrypt the specified content for the specified recipients.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodExport(IEnumerableMailboxAddress, CancellationToken)
Exports the keys for the specified mailboxes.
(Inherited from CryptographyContext.)
Public methodExport(IEnumerablePgpPublicKey, CancellationToken)
Export the specified public keys.
Public methodExport(PgpPublicKeyRingBundle, CancellationToken)
Export the specified public keys.
Public methodExport(IEnumerableMailboxAddress, Stream, Boolean, CancellationToken)
Export the public keyrings for the specified mailboxes.
Public methodExport(IEnumerablePgpPublicKey, Stream, Boolean, CancellationToken)
Export the specified public keys.
Public methodExport(PgpPublicKeyRingBundle, Stream, Boolean, CancellationToken)
Export the public keyring bundle.
Public methodExportAsync(IEnumerableMailboxAddress, CancellationToken)
Asynchronously exports the keys for the specified mailboxes.
(Inherited from CryptographyContext.)
Public methodExportAsync(IEnumerablePgpPublicKey, CancellationToken)
Asynchronously export the specified public keys.
Public methodExportAsync(PgpPublicKeyRingBundle, CancellationToken)
Asynchronously export the specified public keys.
Public methodExportAsync(IEnumerableMailboxAddress, Stream, Boolean, CancellationToken)
Asynchronously export the public keyrings for the specified mailboxes.
Public methodExportAsync(IEnumerablePgpPublicKey, Stream, Boolean, CancellationToken)
Asynchronously export the specified public keys.
Public methodExportAsync(PgpPublicKeyRingBundle, Stream, Boolean, CancellationToken)
Asynchronously export the public keyring bundle.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodStatic memberGetDigestAlgorithm(HashAlgorithmTag)
Gets the equivalent DigestAlgorithm for the specified HashAlgorithmTag.
Public methodGetDigestAlgorithm(String)
Get the digest algorithm from the micalg parameter value in a multipart/signed part.
(Overrides CryptographyContextGetDigestAlgorithm(String).)
Public methodGetDigestAlgorithmName
Get the string name of the digest algorithm for use with the micalg parameter of a multipart/signed part.
(Overrides CryptographyContextGetDigestAlgorithmName(DigestAlgorithm).)
Public methodStatic memberGetHashAlgorithm
Gets the equivalent HashAlgorithmTag for the specified DigestAlgorithm.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Protected methodGetPasswordForKey
Get the password for a secret key.
Protected methodGetPrivateKey
Gets the private key from the specified secret key.
Public methodStatic memberGetPublicKeyAlgorithm
Gets the equivalent PublicKeyAlgorithm for the specified PublicKeyAlgorithmTag.
Protected methodGetPublicKeyRing
Get the public keyring that contains the specified key.
Protected methodGetPublicKeyRingAsync
Asynchronously get the public keyring that contains the specified key asynchronously.
Public methodGetPublicKeys
Get the public keys for the specified mailbox addresses.
Public methodGetPublicKeysAsync
Asynchronously get the public keys for the specified mailbox addresses.
Protected methodGetSecretKey
Get the secret key for a specified key identifier.
Protected methodGetSecretKeyAsync
Asynchronously get the secret key for a specified key identifier.
Public methodGetSigningKey
Get the signing key associated with the mailbox address.
Public methodGetSigningKeyAsync
Asynchronously get the signing key associated with the mailbox address.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodImport(PgpPublicKeyRing, CancellationToken)
Import a public pgp keyring.
Public methodImport(PgpPublicKeyRingBundle, CancellationToken)
Import the specified public keyring bundle.
Public methodImport(PgpSecretKeyRing, CancellationToken)
Import a secret pgp keyring.
Public methodImport(PgpSecretKeyRingBundle, CancellationToken)
Import a secret pgp keyring bundle.
Public methodImport(Stream, CancellationToken)
Import public pgp keys from the specified stream.
(Overrides CryptographyContextImport(Stream, CancellationToken).)
Public methodImportAsync
Asynchronously import public pgp keys from the specified stream.
(Overrides CryptographyContextImportAsync(Stream, CancellationToken).)
Public methodIsEnabled(DigestAlgorithm)
Check whether the specified digest algorithm is enabled.
(Inherited from CryptographyContext.)
Public methodIsEnabled(EncryptionAlgorithm)
Check whether the specified encryption algorithm is enabled.
(Inherited from CryptographyContext.)
Protected methodStatic memberIsExpired
Check if a public key is expired.
Protected methodStatic memberIsMatch(PgpPublicKey, MailboxAddress)
Check that a public key is a match for the specified mailbox.
Protected methodStatic memberIsMatch(PgpSecretKey, MailboxAddress)
Check that a secret key is a match for the specified mailbox.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodRetrievePublicKeyRing
Retrieve the public keyring using the configured key server.
Protected methodRetrievePublicKeyRingAsync
Asynchronously retrieve the public keyring using the configured key server.
Public methodSign(MailboxAddress, DigestAlgorithm, Stream, CancellationToken)
Sign the content using the specified signer and digest algorithm.
(Overrides CryptographyContextSign(MailboxAddress, DigestAlgorithm, Stream, CancellationToken).)
Public methodSign(PgpSecretKey, DigestAlgorithm, Stream, CancellationToken)
Sign the content using the specified signer and digest algorithm.
Public methodSignAndEncrypt(MailboxAddress, DigestAlgorithm, IEnumerableMailboxAddress, Stream, CancellationToken)
Sign and encrypt the specified content for the specified recipients.
Public methodSignAndEncrypt(PgpSecretKey, DigestAlgorithm, IEnumerablePgpPublicKey, Stream, CancellationToken)
Sign and encrypt the specified content for the specified recipients.
Public methodSignAndEncrypt(MailboxAddress, DigestAlgorithm, EncryptionAlgorithm, IEnumerableMailboxAddress, Stream, CancellationToken)
Sign and encrypt the specified content for the specified recipients.
Public methodSignAndEncrypt(PgpSecretKey, DigestAlgorithm, EncryptionAlgorithm, IEnumerablePgpPublicKey, Stream, CancellationToken)
Sign and encrypt the specified content for the specified recipients.
Public methodSignAndEncryptAsync(MailboxAddress, DigestAlgorithm, IEnumerableMailboxAddress, Stream, CancellationToken)
Asynchronously sign and encrypt the specified content for the specified recipients.
Public methodSignAndEncryptAsync(PgpSecretKey, DigestAlgorithm, IEnumerablePgpPublicKey, Stream, CancellationToken)
Asynchronously sign and encrypt the specified content for the specified recipients.
Public methodSignAndEncryptAsync(MailboxAddress, DigestAlgorithm, EncryptionAlgorithm, IEnumerableMailboxAddress, Stream, CancellationToken)
Asynchronously sign and encrypt the specified content for the specified recipients.
Public methodSignAndEncryptAsync(PgpSecretKey, DigestAlgorithm, EncryptionAlgorithm, IEnumerablePgpPublicKey, Stream, CancellationToken)
Asynchronously sign and encrypt the specified content for the specified recipients.
Public methodSignAsync(MailboxAddress, DigestAlgorithm, Stream, CancellationToken)
Asynchronously sign the content using the specified signer and digest algorithm.
(Overrides CryptographyContextSignAsync(MailboxAddress, DigestAlgorithm, Stream, CancellationToken).)
Public methodSignAsync(PgpSecretKey, DigestAlgorithm, Stream, CancellationToken)
Asynchronously sign the content using the specified signer and digest algorithm.
Public methodSupports
Check whether or not the specified protocol is supported.
(Overrides CryptographyContextSupports(String).)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodVerify
Verify the specified content using the detached signatureData.
(Overrides CryptographyContextVerify(Stream, Stream, CancellationToken).)
Public methodVerifyAsync
Asynchronously verify the specified content using the detached signatureData.
(Overrides CryptographyContextVerifyAsync(Stream, Stream, CancellationToken).)
Top
Remarks

An abstract OpenPGP cryptography context which can be used for PGP/MIME.

Note Note
Generally speaking, applications should not use an OpenPgpContext directly, but rather via higher level APIs such as MultipartSigned and MultipartEncrypted.
See Also