# CmsEnvelopedDataService

Creates and decrypts CMS EnvelopedData for X.509 recipients.

Class 

`OfficeIMO.Security`

**Namespace**

`OfficeIMO.Security`

**Assembly**

`OfficeIMO.Security`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[CmsEnvelopedDataService.cs:20](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Security/CmsEnvelopedDataService.cs#L20)

**Modifiers**

static

Creates and decrypts CMS EnvelopedData for X.509 recipients.

## Inheritance

- object
- CmsEnvelopedDataService

Filter members 

Show inherited

## Methods

`public static CmsDecryptionResult Decrypt(byte[] encodedCms, X509Certificate2 recipientCertificate, CmsEnvelopeOptions? options = null)` [#](#method-decrypt-byte-security-cryptography-x509certificates-x509certificate2-officeimo-security-cmsenvelopeoptions)

[CmsEnvelopedDataService.cs:48](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Security/CmsEnvelopedDataService.cs#L48)

Decrypts content for a matching RSA recipient certificate.

Parameters

**encodedCms byte[] required**

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

**options OfficeIMO.Security.CmsEnvelopeOptions? = null optional**

Returns

`CmsDecryptionResult`

`public static byte[] Encrypt(byte[] content, IEnumerable<X509Certificate2> recipients, CmsEnvelopeOptions? options = null)` [#](#method-encrypt-byte-collections-generic-ienumerable-system-security-cryptography-x509certificates-x509certificate2-officeimo-security-cmsenvelopeoptions)

[CmsEnvelopedDataService.cs:20](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Security/CmsEnvelopedDataService.cs#L20)

Encrypts content for every supplied recipient certificate.

Parameters

**content byte[] required**

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

**options OfficeIMO.Security.CmsEnvelopeOptions? = null optional**

Returns

`byte[]`

## 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?`

<!-- PowerForge markdown artifact sha256:A00957C1069D24321E9B0E91C133067A2D7908930F264CC815D13E5CD2E96D83 -->
