Class RsaOaepMgf1pXmlKeyEncryptionExtension
- Namespace
- ComponentSpace.Saml2.XmlSecurity.Encryption
- Assembly
- ComponentSpace.Saml2.dll
Supports the RSA-OAEP-MGF1P XML key encryption algorithms.
public class RsaOaepMgf1pXmlKeyEncryptionExtension : IXmlKeyEncryptionExtension, IXmlEncryptionExtension
- Inheritance
-
RsaOaepMgf1pXmlKeyEncryptionExtension
- Implements
- Inherited Members
Remarks
The supported key encryption algorithms are:
- http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p
The algorithm http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p uses the fixed MGF1 with SHA-1 mask generation function.
The optional DigestMethod child element specifies the digest method. It defaults to SHA-1.
This implementation uses the EncryptedXml class which only supports the SHA-1 digest method and MGF1 with SHA-1 mask generation function.
Any DigestMethod child element is ignored.
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
encryptedKeyEncryptedKeyThe encrypted symmetric key.
keyDecryptingKeyAsymmetricAlgorithmThe asymmetric key decrypting key.
keyEncryptionAlgorithmstringThe 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
symmetricKeybyte[]The symmetric key.
keyEncryptingKeyAsymmetricAlgorithmThe asymmetric key encrypting key.
keyEncryptionAlgorithmstringThe key encryption algorithm.
digestMethodstringThe digest method.
maskGenerationFunctionstringThe 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
encryptionAlgorithmstringThe encryption algorithm.
Returns
- bool
trueif the encryption algorithm is supported; otherwisefalse.
Update(XmlElement, string, string, string)
Updates the encrypted data XML, if required.
public void Update(XmlElement encryptedDataElement, string keyEncryptionAlgorithm, string digestMethod, string maskGenerationFunction)
Parameters
encryptedDataElementXmlElementThe encrypted data XML.
keyEncryptionAlgorithmstringThe key encryption algorithm.
digestMethodstringThe digest method.
maskGenerationFunctionstringThe mask generation function.