# PdfPublicKeyEncryptionOptions

Encrypts a PDF for certificate recipients with the public-key security handler (/Filter /Adobe.PubSec, /SubFilter /adbe.pkcs7.s5, AES-256).

Class 

`OfficeIMO.Pdf`

**Namespace**

`OfficeIMO.Pdf`

**Assembly**

`OfficeIMO.Pdf`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[PdfPublicKeyEncryptionOptions.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Pdf/Model/PdfPublicKeyEncryptionOptions.cs#L15)

**Modifiers**

sealed

Encrypts a PDF for certificate recipients with the public-key security handler (/Filter /Adobe.PubSec, /SubFilter /adbe.pkcs7.s5, AES-256). Each recipient opens the file with its private key; no password exists.

## Inheritance

- object
- PdfPublicKeyEncryptionOptions

## Remarks

The security provider creates the CMS EnvelopedData that carries the file key seed and permissions to every recipient. Certificates and the provider are not exposed as public properties, so option snapshots never copy certificate material.

## Usage

Explore 1 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Accepted by parameters 1

- Method [PdfDocumentSecurity.EncryptForRecipients](/api/pdf/officeimo-pdf-pdfdocumentsecurity/#method-encryptforrecipients-officeimo-pdf-pdfpublickeyencryptionoptions) parameter `encryption`

Filter members 

Show inherited

## Constructors

PdfPublicKeyEncryptionOptions 2 overloads

`public PdfPublicKeyEncryptionOptions(IOfficeSecurityProvider securityProvider, IEnumerable<X509Certificate2> recipientCertificates)` [#](#constructor-ctor-officeimo-security-iofficesecurityprovider-collections-generic-ienumerable-system-security-cryptography-x509certificates-x509certificate2)

[PdfPublicKeyEncryptionOptions.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Pdf/Model/PdfPublicKeyEncryptionOptions.cs#L15)

Creates public-key encryption options for one or more recipient certificates.

Parameters

**securityProvider OfficeIMO.Security.IOfficeSecurityProvider required**

Provider that creates CMS EnvelopedData, for example OfficeSecurityProvider from OfficeIMO.Security.

**recipientCertificates System.Collections.Generic.IEnumerable<System.Security.Cryptography.X509Certificates.X509Certificate2> required**

Recipient certificates. Only their public keys are used.

`public PdfPublicKeyEncryptionOptions(IOfficeSecurityProvider securityProvider, X509Certificate2 recipientCertificate)` [#](#constructor-ctor-officeimo-security-iofficesecurityprovider-security-cryptography-x509certificates-x509certificate2)

[PdfPublicKeyEncryptionOptions.cs:40](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Pdf/Model/PdfPublicKeyEncryptionOptions.cs#L40)

Creates public-key encryption options for one recipient certificate.

Parameters

**securityProvider OfficeIMO.Security.IOfficeSecurityProvider required**

**recipientCertificate System.Security.Cryptography.X509Certificates.X509Certificate2 required**

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public int RecipientCount { get; }` [#](#property-recipientcount)

[PdfPublicKeyEncryptionOptions.cs:48](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Pdf/Model/PdfPublicKeyEncryptionOptions.cs#L48)

Number of recipient certificates the document is encrypted to.

`public PdfStandardPermissions AllowedPermissions { get; set; }` [#](#property-allowedpermissions)

[PdfPublicKeyEncryptionOptions.cs:52](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Pdf/Model/PdfPublicKeyEncryptionOptions.cs#L52)

Operations every recipient may perform. Defaults to all standard operations.

`public bool EncryptMetadata { get; set; }` [#](#property-encryptmetadata)

[PdfPublicKeyEncryptionOptions.cs:62](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Pdf/Model/PdfPublicKeyEncryptionOptions.cs#L62)

Whether document metadata streams are encrypted. Defaults to true.

`public IOfficeAesCryptographyProvider? AesCryptographyProvider { get; set; }` [#](#property-aescryptographyprovider)

[PdfPublicKeyEncryptionOptions.cs:67](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Pdf/Model/PdfPublicKeyEncryptionOptions.cs#L67)

Optional synchronous AES provider used when the host does not expose platform AES-CBC, such as browser WebAssembly.

<!-- PowerForge markdown artifact sha256:7D32C0768A66A7AD23D3041DE716E907511A5A0AFF700F6732C2B391E428A503 -->
