Click or drag to resize
MimeKit

OpenPgpContext Class

An abstract OpenPGP cryptography context which can be used for OpenPGP and PGP/MIME that manages keyrings stored on the local file system as keyring bundles.
Inheritance Hierarchy

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

The OpenPgpContext type exposes the following members.

Constructors
  NameDescription
Protected methodOpenPgpContext
Initialize a new instance of the OpenPgpContext class.
Protected methodOpenPgpContext(String, String)
Initialize a new instance of the OpenPgpContext class.
Top
Properties
  NameDescription
Public propertyAutoKeyRetrieve
Get or set whether unknown PGP keys should automtically be retrieved.
(Inherited from OpenPgpContextBase.)
Public propertyDefaultEncryptionAlgorithm
Get or set the default encryption algorithm.
(Inherited from OpenPgpContextBase.)
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.
(Inherited from OpenPgpContextBase.)
Public propertyKeyExchangeProtocol
Get the key exchange protocol.
(Inherited from OpenPgpContextBase.)
Public propertyKeyServer
Get or set the key server to use when automatically retrieving keys.
(Inherited from OpenPgpContextBase.)
Public propertyPublicKeyRingBundle
Get the public keyring bundle.
Protected propertyPublicKeyRingPath
Get the public keyring path.
Public propertySecretKeyRingBundle
Get the secret keyring bundle.
Protected propertySecretKeyRingPath
Get the secret keyring path.
Public propertySignatureProtocol
Get the signature protocol.
(Inherited from OpenPgpContextBase.)
Top
Methods
  NameDescription
Public methodCanEncrypt
Check whether or not the cryptography context can encrypt to a particular recipient.
(Overrides CryptographyContextCanEncrypt(MailboxAddress).)
Public methodCanSign
Check whether or not a particular mailbox address can be used for signing.
(Overrides CryptographyContextCanSign(MailboxAddress).)
Public methodDecrypt(Stream, CancellationToken)
Decrypts the specified encryptedData.
(Inherited from OpenPgpContextBase.)
Public methodDecrypt(Stream, DigitalSignatureCollection, CancellationToken)
Decrypts the specified encryptedData and extracts the digital signers if the content was also signed.
(Inherited from OpenPgpContextBase.)
Public methodDecryptTo
Decrypt an encrypted stream and extract the digital signers if the content was also signed.
(Inherited from OpenPgpContextBase.)
Public methodDecryptToAsync
Asynchronously decrypt an encrypted stream and extract the digital signers if the content was also signed.
(Inherited from OpenPgpContextBase.)
Public methodDelete(PgpPublicKeyRing)
Delete a public pgp keyring.
Public methodDelete(PgpSecretKeyRing)
Delete a secret pgp keyring.
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.
(Inherited from OpenPgpContextBase.)
Public methodEnable(DigestAlgorithm)
Enable the digest algorithm.
(Inherited from CryptographyContext.)
Public methodEnable(EncryptionAlgorithm)
Enable the encryption algorithm.
(Inherited from CryptographyContext.)
Public methodEncrypt(IEnumerablePgpPublicKey, Stream)
Encrypt the specified content for the specified recipients.
(Inherited from OpenPgpContextBase.)
Public methodEncrypt(IEnumerableMailboxAddress, Stream)
Encrypt the specified content for the specified recipients.
(Inherited from OpenPgpContextBase.)
Public methodEncrypt(EncryptionAlgorithm, IEnumerableMailboxAddress, Stream)
Encrypt the specified content for the specified recipients.
(Inherited from OpenPgpContextBase.)
Public methodEncrypt(EncryptionAlgorithm, IEnumerablePgpPublicKey, Stream)
Encrypt the specified content for the specified recipients.
(Inherited from OpenPgpContextBase.)
Public methodEnumeratePublicKeyRings
Enumerate all public keyrings.
Public methodEnumeratePublicKeyRings(MailboxAddress)
Enumerate the public keyrings for a particular mailbox.
Public methodEnumeratePublicKeys
Enumerate all public keys.
Public methodEnumeratePublicKeys(MailboxAddress)
Enumerate the public keys for a particular mailbox.
Public methodEnumerateSecretKeyRings
Enumerate all secret keyrings.
Public methodEnumerateSecretKeyRings(MailboxAddress)
Enumerate the secret keyrings for a particular mailbox.
Public methodEnumerateSecretKeys
Enumerate all secret keys.
Public methodEnumerateSecretKeys(MailboxAddress)
Enumerate the secret keys for a particular mailbox.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodExport(PgpPublicKeyRingBundle)
Export the specified public keys.
Public methodExport(IEnumerablePgpPublicKey)
Exports the specified public keys.
Public methodExport(IEnumerableMailboxAddress)
Exports the public keys for the specified mailboxes.
(Overrides CryptographyContextExport(IEnumerableMailboxAddress).)
Public methodExport(PgpPublicKeyRingBundle, Stream, Boolean)
Export the public keyring bundle.
Public methodExport(IEnumerablePgpPublicKey, Stream, Boolean)
Export the specified public keys.
Public methodExport(IEnumerableMailboxAddress, Stream, Boolean)
Export the public keyrings for the specified mailboxes.
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 methodGenerateKeyPair
Generate a new key pair.
Public methodGetDigestAlgorithm(String)
Get the digest algorithm from the micalg parameter value in a multipart/signed part.
(Inherited from OpenPgpContextBase.)
Public methodGetDigestAlgorithmName
Get the string name of the digest algorithm for use with the micalg parameter of a multipart/signed part.
(Inherited from OpenPgpContextBase.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Protected methodGetPasswordForKey
Get the password for a secret key.
(Inherited from OpenPgpContextBase.)
Protected methodGetPrivateKey
Gets the private key from the specified secret key.
(Inherited from OpenPgpContextBase.)
Protected methodGetPublicKey
Get the public key associated with the mailbox address.
Protected methodGetPublicKeyRing
Get the public keyring that contains the specified key.
(Overrides OpenPgpContextBaseGetPublicKeyRing(Int64, CancellationToken).)
Protected methodGetPublicKeyRingAsync
Asynchronously get the public keyring that contains the specified key.
(Overrides OpenPgpContextBaseGetPublicKeyRingAsync(Int64, CancellationToken).)
Public methodGetPublicKeys
Get the public keys for the specified mailbox addresses.
(Overrides OpenPgpContextBaseGetPublicKeys(IEnumerableMailboxAddress).)
Protected methodGetSecretKey
Get the secret key for a specified key identifier.
(Overrides OpenPgpContextBaseGetSecretKey(Int64).)
Public methodGetSigningKey
Get the signing key associated with the mailbox address.
(Overrides OpenPgpContextBaseGetSigningKey(MailboxAddress).)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodImport(PgpPublicKeyRing)
Imports a public pgp keyring.
Public methodImport(PgpPublicKeyRingBundle)
Imports a public pgp keyring bundle.
(Overrides OpenPgpContextBaseImport(PgpPublicKeyRingBundle).)
Public methodImport(PgpSecretKeyRing)
Imports a secret pgp keyring.
Public methodImport(PgpSecretKeyRingBundle)
Imports a secret pgp keyring bundle.
Public methodImport(Stream)
Imports public pgp keys from the specified stream.
(Overrides CryptographyContextImport(Stream).)
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 methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodRetrievePublicKeyRing
Retrieve the public keyring using the configured key server.
(Inherited from OpenPgpContextBase.)
Protected methodRetrievePublicKeyRingAsync
Asynchronously retrieve the public keyring using the configured key server.
(Inherited from OpenPgpContextBase.)
Protected methodSavePublicKeyRingBundle
Saves the public key-ring bundle.
Protected methodSaveSecretKeyRingBundle
Saves the secret key-ring bundle.
Public methodSign(PgpSecretKey, DigestAlgorithm, Stream)
Cryptographically signs the content.
(Inherited from OpenPgpContextBase.)
Public methodSign(MailboxAddress, DigestAlgorithm, Stream)
Cryptographically signs the content.
(Inherited from OpenPgpContextBase.)
Public methodSignAndEncrypt(PgpSecretKey, DigestAlgorithm, IEnumerablePgpPublicKey, Stream)
Cryptographically sign and encrypt the specified content for the specified recipients.
(Inherited from OpenPgpContextBase.)
Public methodSignAndEncrypt(MailboxAddress, DigestAlgorithm, IEnumerableMailboxAddress, Stream)
Cryptographically sign and encrypt the specified content for the specified recipients.
(Inherited from OpenPgpContextBase.)
Public methodSignAndEncrypt(PgpSecretKey, DigestAlgorithm, EncryptionAlgorithm, IEnumerablePgpPublicKey, Stream)
Cryptographically sign and encrypt the specified content for the specified recipients.
(Inherited from OpenPgpContextBase.)
Public methodSignAndEncrypt(MailboxAddress, DigestAlgorithm, EncryptionAlgorithm, IEnumerableMailboxAddress, Stream)
Cryptographically sign and encrypt the specified content for the specified recipients.
(Inherited from OpenPgpContextBase.)
Public methodSignKey
Sign a public key.
Public methodSupports
Check whether or not the specified protocol is supported.
(Inherited from OpenPgpContextBase.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodVerify
Verify the specified content using the detached signatureData.
(Inherited from OpenPgpContextBase.)
Public methodVerifyAsync
Asynchronously verify the specified content using the detached signatureData.
(Inherited from OpenPgpContextBase.)
Top
Remarks

PGP software such as older versions of GnuPG (pre 2.1.0) typically store the user's keyrings on the file system using the OpenPGP Keyring Bundle format.

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