EncryptedSecurityTokenHandler.ReadToken Method (XmlReader)

.NET Framework (current version)

Reads an encrypted security token.

Namespace:   System.IdentityModel.Tokens
Assembly:  System.IdentityModel (in System.IdentityModel.dll)

public override SecurityToken ReadToken(
	XmlReader reader


Type: System.Xml.XmlReader

The reader from which to read the token.

Return Value

Type: System.IdentityModel.Tokens.SecurityToken

A security token of type EncryptedSecurityToken.

Exception Condition

reader is null.


There is no configured service token resolver. (Either the SecurityTokenHandler.Configuration property or the SecurityTokenHandlerConfiguration.ServiceTokenResolver property of the referenced token handler configuration is null. A service token resolver is required to obtain keys for decryption.


The SecurityTokenHandlerCollectionReferenced through the ContainingCollection property is unable to find a SecurityTokenHandler that can read the decrypted XML and return a SecurityToken.


A SecurityKeyIdentifier is not found inside the XML pointed to by the reader.


The SecurityKeyIdentifier is not a SymmetricSecurityKey.


The SecurityKeyIdentifier found inside the XML cannot be resolved by the configured service token resolver to a SecurityKey.

.NET Framework
Available since 4.5
Return to top