Show / Hide Table of Contents

Class EncryptedID

Represents an encrypted identifier.

Inheritance
System.Object
EncryptedElementType
EncryptedID
Inherited Members
EncryptedElementType.GetKeyInfo(XmlElement)
EncryptedElementType.GetCertificate(XmlElement)
EncryptedElementType.EncryptedData
EncryptedElementType.EncryptedKeys
EncryptedElementType.ToXml(XmlElement)
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: ComponentSpace.SAML2.Assertions
Assembly: ComponentSpace.Saml2.dll
Syntax
public class EncryptedID : EncryptedElementType
Remarks

Refer to the Assertions and Protocol for the OASIS Security Assertion Markup Language (SAML) V2.0 specification for further details.

Constructors

EncryptedID()

Initializes a new instance of the EncryptedID class.

Declaration
public EncryptedID()

EncryptedID(NameID, AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod, KeyInfo)

Initializes a new instance of the EncryptedID class from a name identifier.

Declaration
public EncryptedID(NameID nameID, AsymmetricAlgorithm keyEncryptingKey, EncryptionMethod keyEncryptionMethod, EncryptionMethod dataEncryptionMethod, KeyInfo keyInfo)
Parameters
Type Name Description
NameID nameID

The name identifier.

System.Security.Cryptography.AsymmetricAlgorithm keyEncryptingKey

The asymmetric key encrypting key.

System.Security.Cryptography.Xml.EncryptionMethod keyEncryptionMethod

The method for encrypting the symmetric key.

System.Security.Cryptography.Xml.EncryptionMethod dataEncryptionMethod

The method for encrypting the data.

System.Security.Cryptography.Xml.KeyInfo keyInfo

The key info to include with the encrypted data.

Remarks

A random symmetric session key is generated from the public asymmetric key. The symmetric key is used to encrypt the data.

The specified key encryption method is used. For example, http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p.

The specified data encryption method is used. For example, http://www.w3.org/2001/04/xmlenc#aes256-cbc.

Exceptions
Type Condition
SAMLSerializationException

Thrown when the XML deserialization fails.

SAMLEncryptionException

Thrown when the encryption fails.

See Also
Decrypt(AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod)
Decrypt(X509Certificate2, EncryptionMethod, EncryptionMethod)

EncryptedID(NameID, AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod, String, String, KeyInfo)

Initializes a new instance of the EncryptedID class from a name identifier.

Declaration
public EncryptedID(NameID nameID, AsymmetricAlgorithm keyEncryptingKey, EncryptionMethod keyEncryptionMethod, EncryptionMethod dataEncryptionMethod, string digestMethod, string maskGenerationFunction, KeyInfo keyInfo)
Parameters
Type Name Description
NameID nameID

The name identifier.

System.Security.Cryptography.AsymmetricAlgorithm keyEncryptingKey

The asymmetric key encrypting key.

System.Security.Cryptography.Xml.EncryptionMethod keyEncryptionMethod

The method for encrypting the symmetric key.

System.Security.Cryptography.Xml.EncryptionMethod dataEncryptionMethod

The method for encrypting the data.

System.String digestMethod

The key encryption digest method or null.

System.String maskGenerationFunction

The key encryption mask generation function.

System.Security.Cryptography.Xml.KeyInfo keyInfo

The key info to include with the encrypted data.

Remarks

A random symmetric session key is generated from the public asymmetric key. The symmetric key is used to encrypt the data.

The specified key encryption method is used. For example, http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p.

The specified data encryption method is used. For example, http://www.w3.org/2001/04/xmlenc#aes256-cbc.

Exceptions
Type Condition
SAMLSerializationException

Thrown when the XML deserialization fails.

SAMLEncryptionException

Thrown when the encryption fails.

See Also
Decrypt(AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod)
Decrypt(X509Certificate2, EncryptionMethod, EncryptionMethod)

EncryptedID(NameID, AsymmetricAlgorithm, EncryptionMethod, KeyInfo)

Initializes a new instance of the EncryptedID class from a name identifier.

Declaration
public EncryptedID(NameID nameID, AsymmetricAlgorithm keyEncryptingKey, EncryptionMethod dataEncryptionMethod, KeyInfo keyInfo)
Parameters
Type Name Description
NameID nameID

The name identifier.

System.Security.Cryptography.AsymmetricAlgorithm keyEncryptingKey

The asymmetric key encrypting key.

System.Security.Cryptography.Xml.EncryptionMethod dataEncryptionMethod

The method for encrypting the data.

System.Security.Cryptography.Xml.KeyInfo keyInfo

The key info to include with the encrypted data.

Remarks

A random symmetric session key is generated from the public asymmetric key. The symmetric key is used to encrypt the data.

The encryption method for the encrypted symmetric key is http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p.

The specified data encryption method is used. For example, http://www.w3.org/2001/04/xmlenc#aes256-cbc.

Exceptions
Type Condition
SAMLSerializationException

Thrown when the XML deserialization fails.

SAMLEncryptionException

Thrown when the encryption fails.

See Also
Decrypt(AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod)
Decrypt(X509Certificate2, EncryptionMethod, EncryptionMethod)

EncryptedID(NameID, X509Certificate2, EncryptionMethod)

Initializes a new instance of the EncryptedID class from a name identifier.

Declaration
public EncryptedID(NameID nameID, X509Certificate2 x509Certificate, EncryptionMethod dataEncryptionMethod)
Parameters
Type Name Description
NameID nameID

The name identifier.

System.Security.Cryptography.X509Certificates.X509Certificate2 x509Certificate

The X.509 certificate used when encrypting the data.

System.Security.Cryptography.Xml.EncryptionMethod dataEncryptionMethod

The method for encrypting the data.

Remarks

A random symmetric session key is generated from the public key contained within the X.509 certificate. The symmetric key is used to encrypt the data.

The encryption method for the encrypted symmetric key is http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p.

The specified data encryption method is used. For example, http://www.w3.org/2001/04/xmlenc#aes256-cbc.

Exceptions
Type Condition
SAMLSerializationException

Thrown when the XML deserialization fails.

SAMLEncryptionException

Thrown when the encryption fails.

See Also
Decrypt(AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod)
Decrypt(X509Certificate2, EncryptionMethod, EncryptionMethod)

EncryptedID(NameID, X509Certificate2, EncryptionMethod, EncryptionMethod)

Initializes a new instance of the EncryptedID class from a name identifier.

Declaration
public EncryptedID(NameID nameID, X509Certificate2 x509Certificate, EncryptionMethod keyEncryptionMethod, EncryptionMethod dataEncryptionMethod)
Parameters
Type Name Description
NameID nameID

The name identifier.

System.Security.Cryptography.X509Certificates.X509Certificate2 x509Certificate

The X.509 certificate used when encrypting the data.

System.Security.Cryptography.Xml.EncryptionMethod keyEncryptionMethod

The method for encrypting the symmetric key.

System.Security.Cryptography.Xml.EncryptionMethod dataEncryptionMethod

The method for encrypting the data.

Remarks

A random symmetric session key is generated from the public key contained within the X.509 certificate. The symmetric key is used to encrypt the data.

The specified key encryption method is used. For example, http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p.

The specified data encryption method is used. For example, http://www.w3.org/2001/04/xmlenc#aes256-cbc.

Exceptions
Type Condition
SAMLSerializationException

Thrown when the XML deserialization fails.

SAMLEncryptionException

Thrown when the encryption fails.

See Also
Decrypt(AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod)
Decrypt(X509Certificate2, EncryptionMethod, EncryptionMethod)

EncryptedID(NameID, X509Certificate2, EncryptionMethod, EncryptionMethod, String, String)

Initializes a new instance of the EncryptedID class from a name identifier.

Declaration
public EncryptedID(NameID nameID, X509Certificate2 x509Certificate, EncryptionMethod keyEncryptionMethod, EncryptionMethod dataEncryptionMethod, string digestMethod, string maskGenerationFunction)
Parameters
Type Name Description
NameID nameID

The name identifier.

System.Security.Cryptography.X509Certificates.X509Certificate2 x509Certificate

The X.509 certificate used when encrypting the data.

System.Security.Cryptography.Xml.EncryptionMethod keyEncryptionMethod

The method for encrypting the symmetric key.

System.Security.Cryptography.Xml.EncryptionMethod dataEncryptionMethod

The method for encrypting the data.

System.String digestMethod

The key encryption digest method or null.

System.String maskGenerationFunction

The key encryption mask generation function or null.

Remarks

A random symmetric session key is generated from the public key contained within the X.509 certificate. The symmetric key is used to encrypt the data.

The specified key encryption method is used. For example, http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p.

The specified data encryption method is used. For example, http://www.w3.org/2001/04/xmlenc#aes256-cbc.

Exceptions
Type Condition
SAMLSerializationException

Thrown when the XML deserialization fails.

SAMLEncryptionException

Thrown when the encryption fails.

See Also
Decrypt(AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod)
Decrypt(X509Certificate2, EncryptionMethod, EncryptionMethod)

EncryptedID(XmlElement)

Initializes a new instance of the EncryptedID class from XML.

Declaration
public EncryptedID(XmlElement xmlElement)
Parameters
Type Name Description
System.Xml.XmlElement xmlElement

The encrypted identifier XML.

Exceptions
Type Condition
SAMLSerializationException

Thrown when the XML deserialization fails.

EncryptedID(XmlElement, XmlNodeList)

Initializes a new instance of the EncryptedID class.

Declaration
public EncryptedID(XmlElement encryptedData, XmlNodeList encryptedKeys)
Parameters
Type Name Description
System.Xml.XmlElement encryptedData

The encrypted data.

System.Xml.XmlNodeList encryptedKeys

The encrypted keys.

Methods

Decrypt(AsymmetricAlgorithm, EncryptionMethod)

Decrypts an encrypted identifier.

Declaration
public NameID Decrypt(AsymmetricAlgorithm keyDecryptingKey, EncryptionMethod dataEncryptionMethod)
Parameters
Type Name Description
System.Security.Cryptography.AsymmetricAlgorithm keyDecryptingKey

The asymmetric key decrypting key.

System.Security.Cryptography.Xml.EncryptionMethod dataEncryptionMethod

The method for decrypting the data or null if specified in the encrypted data.

Returns
Type Description
NameID

The identifier.

Remarks

The asymmetric key is used to decrypt the symmetric key contained within the encrypted data. The symmetric key is used to decrypt the data.

The encryption method for the encrypted symmetric key is expected to be http://www.w3.org/2001/04/xmlenc#rsa-1_5 or http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p.

The encryption method for the data is specified in the encrypted data or may be explicitly specified.

Exceptions
Type Condition
SAMLSerializationException

Thrown when the XML deserialization fails.

SAMLEncryptionException

Thrown when the decryption fails.

See Also
EncryptedID(NameID, AsymmetricAlgorithm, EncryptionMethod, KeyInfo)
EncryptedID(NameID, X509Certificate2, EncryptionMethod)

Decrypt(AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod)

Decrypts an encrypted identifier.

Declaration
public NameID Decrypt(AsymmetricAlgorithm keyDecryptingKey, EncryptionMethod keyEncryptionMethod, EncryptionMethod dataEncryptionMethod)
Parameters
Type Name Description
System.Security.Cryptography.AsymmetricAlgorithm keyDecryptingKey

The asymmetric key decrypting key.

System.Security.Cryptography.Xml.EncryptionMethod keyEncryptionMethod

The method for decrypting the symmetric key or null if specified in the encrypted key.

System.Security.Cryptography.Xml.EncryptionMethod dataEncryptionMethod

The method for decrypting the data or null if specified in the encrypted data.

Returns
Type Description
NameID

The identifier.

Remarks

The asymmetric key is used to decrypt the symmetric key contained within the encrypted data. The symmetric key is used to decrypt the data.

The encryption method for the encrypted symmetric key is expected to be http://www.w3.org/2001/04/xmlenc#rsa-1_5 or http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p.

The encryption method for the key is specified in the encrypted data or may be explicitly specified.

The encryption method for the data is specified in the encrypted data or may be explicitly specified.

Exceptions
Type Condition
SAMLSerializationException

Thrown when the XML deserialization fails.

SAMLEncryptionException

Thrown when the decryption fails.

See Also
EncryptedID(NameID, AsymmetricAlgorithm, EncryptionMethod, KeyInfo)
EncryptedID(NameID, X509Certificate2, EncryptionMethod)

Decrypt(X509Certificate2, EncryptionMethod)

Decrypts an encrypted identifier.

Declaration
public NameID Decrypt(X509Certificate2 x509Certificate, EncryptionMethod dataEncryptionMethod)
Parameters
Type Name Description
System.Security.Cryptography.X509Certificates.X509Certificate2 x509Certificate

The X.509 certificate containing a private key.

System.Security.Cryptography.Xml.EncryptionMethod dataEncryptionMethod

The method for decrypting the data or null if specified in the encrypted data.

Returns
Type Description
NameID

The identifier.

Remarks

The X.509 certificate's private key is used to decrypt the symmetric key contained within the encrypted data. The symmetric key is used to decrypt the data.

The encryption method for the encrypted symmetric key is expected to be http://www.w3.org/2001/04/xmlenc#rsa-1_5 or http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p.

The encryption method for the data is specified in the encrypted data or may be explicitly specified.

Exceptions
Type Condition
SAMLSerializationException

Thrown when the XML deserialization fails.

SAMLEncryptionException

Thrown when the decryption fails.

See Also
EncryptedID(NameID, AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod, KeyInfo)
EncryptedID(NameID, X509Certificate2, EncryptionMethod, EncryptionMethod)

Decrypt(X509Certificate2, EncryptionMethod, EncryptionMethod)

Decrypts an encrypted identifier.

Declaration
public NameID Decrypt(X509Certificate2 x509Certificate, EncryptionMethod keyEncryptionMethod, EncryptionMethod dataEncryptionMethod)
Parameters
Type Name Description
System.Security.Cryptography.X509Certificates.X509Certificate2 x509Certificate

The X.509 certificate containing a private key.

System.Security.Cryptography.Xml.EncryptionMethod keyEncryptionMethod

The method for decrypting the symmetric key or null if specified in the encrypted key.

System.Security.Cryptography.Xml.EncryptionMethod dataEncryptionMethod

The method for decrypting the data or null if specified in the encrypted data.

Returns
Type Description
NameID

The identifier.

Remarks

The X.509 certificate's private key is used to decrypt the symmetric key contained within the encrypted data. The symmetric key is used to decrypt the data.

The encryption method for the encrypted symmetric key is expected to be http://www.w3.org/2001/04/xmlenc#rsa-1_5 or http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p.

The encryption method for the key is specified in the encrypted data or may be explicitly specified.

The encryption method for the data is specified in the encrypted data or may be explicitly specified.

Exceptions
Type Condition
SAMLSerializationException

Thrown when the XML deserialization fails.

SAMLEncryptionException

Thrown when the decryption fails.

See Also
EncryptedID(NameID, AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod, KeyInfo)
EncryptedID(NameID, X509Certificate2, EncryptionMethod, EncryptionMethod)

IsValid(XmlElement)

Indicates whether the XML is an encrypted identifier.

Declaration
public static bool IsValid(XmlElement xmlElement)
Parameters
Type Name Description
System.Xml.XmlElement xmlElement

The XML to test.

Returns
Type Description
System.Boolean

true if the XML is an encrypted identifier; otherwise false.

ToXml(XmlDocument)

Serializes the encrypted identifier to XML.

Declaration
public XmlElement ToXml(XmlDocument xmlDocument)
Parameters
Type Name Description
System.Xml.XmlDocument xmlDocument

The owning XML document.

Returns
Type Description
System.Xml.XmlElement

The encrypted identifier as XML.

Exceptions
Type Condition
SAMLSerializationException

Thrown when the XML serialization fails.

In This Article
  • Constructors
    • EncryptedID()
    • EncryptedID(NameID, AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod, KeyInfo)
    • EncryptedID(NameID, AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod, String, String, KeyInfo)
    • EncryptedID(NameID, AsymmetricAlgorithm, EncryptionMethod, KeyInfo)
    • EncryptedID(NameID, X509Certificate2, EncryptionMethod)
    • EncryptedID(NameID, X509Certificate2, EncryptionMethod, EncryptionMethod)
    • EncryptedID(NameID, X509Certificate2, EncryptionMethod, EncryptionMethod, String, String)
    • EncryptedID(XmlElement)
    • EncryptedID(XmlElement, XmlNodeList)
  • Methods
    • Decrypt(AsymmetricAlgorithm, EncryptionMethod)
    • Decrypt(AsymmetricAlgorithm, EncryptionMethod, EncryptionMethod)
    • Decrypt(X509Certificate2, EncryptionMethod)
    • Decrypt(X509Certificate2, EncryptionMethod, EncryptionMethod)
    • IsValid(XmlElement)
    • ToXml(XmlDocument)
Back to top Copyright © ComponentSpace Pty Ltd 2004-2022. All rights reserved.