Table of Contents

Class RsaOaepXmlKeyEncryptionExtension

Namespace
ComponentSpace.Saml2.XmlSecurity.Encryption
Assembly
ComponentSpace.Saml2.dll

Supports the RSA-OAEP XML key encryption algorithms.

public class RsaOaepXmlKeyEncryptionExtension : IXmlKeyEncryptionExtension, IXmlEncryptionExtension
Inheritance
RsaOaepXmlKeyEncryptionExtension
Implements
Inherited Members

Remarks

The supported key encryption algorithms are:

  • http://www.w3.org/2009/xmlenc11#rsa-oaep

The algorithm http://www.w3.org/2009/xmlenc11#rsa-oaep uses the specified digest method and mask generation function.

The optional DigestMethod child element specifies the digest method. It defaults to SHA-1. The optional MGF child element specifies the mask generation function. It defaults to MGF1 with SHA-1.

NB. The .NET API has a restriction in that the digest method and MGF must use the same hash algorithm.

Methods

DecryptSymmetricKey(EncryptedKey, AsymmetricAlgorithm, string)

Decrypts the symmetric key using the specified asymmetric key and key encryption algorithm

public byte[] DecryptSymmetricKey(EncryptedKey encryptedKey, AsymmetricAlgorithm keyDecryptingKey, string keyEncryptionAlgorithm)

Parameters

encryptedKey EncryptedKey

The encrypted symmetric key.

keyDecryptingKey AsymmetricAlgorithm

The asymmetric key decrypting key.

keyEncryptionAlgorithm string

The key encryption algorithm.

Returns

byte[]

The decrypted symmetric key.

EncryptSymmetricKey(byte[], AsymmetricAlgorithm, string, string, string)

Encrypts the symmetric key using the specified asymmetric key and key encryption algorithm.

public byte[] EncryptSymmetricKey(byte[] symmetricKey, AsymmetricAlgorithm keyEncryptingKey, string keyEncryptionAlgorithm, string digestMethod, string maskGenerationFunction)

Parameters

symmetricKey byte[]

The symmetric key.

keyEncryptingKey AsymmetricAlgorithm

The asymmetric key encrypting key.

keyEncryptionAlgorithm string

The key encryption algorithm.

digestMethod string

The digest method.

maskGenerationFunction string

The mask generation function.

Returns

byte[]

The encrypted symmetric key.

IsSupported(string)

Indicates whether the encryption algorithm is supported by this extension.

public bool IsSupported(string encryptionAlgorithm)

Parameters

encryptionAlgorithm string

The encryption algorithm.

Returns

bool

true if the encryption algorithm is supported; otherwise false.

Update(XmlElement, string, string, string)

Updates the encrypted data XML, if required.

public void Update(XmlElement encryptedDataElement, string keyEncryptionAlgorithm, string digestMethod, string maskGenerationFunction)

Parameters

encryptedDataElement XmlElement

The encrypted data XML.

keyEncryptionAlgorithm string

The key encryption algorithm.

digestMethod string

The digest method.

maskGenerationFunction string

The mask generation function.