//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ using System; using System.Security.Cryptography; using RSTR = System.IdentityModel.Protocols.WSTrust.RequestSecurityTokenResponse; namespace System.IdentityModel.Tokens { /// /// This class can be used for issuing the asymmetric key based token. /// public class AsymmetricProofDescriptor : ProofDescriptor { SecurityKeyIdentifier _keyIdentifier; /// /// Constructor for extensibility /// public AsymmetricProofDescriptor() { } /// /// Constructs a proof token based on RSA key. /// /// public AsymmetricProofDescriptor( RSA rsaAlgorithm ) { if ( rsaAlgorithm == null ) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "rsaAlgorithm" ); } _keyIdentifier = new SecurityKeyIdentifier(new RsaKeyIdentifierClause(rsaAlgorithm)); } /// /// Constructs a proof token based on key identifier. /// /// public AsymmetricProofDescriptor( SecurityKeyIdentifier keyIdentifier ) { if ( keyIdentifier == null ) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "keyIdentifier" ); } // // This is a key identifier for an asymmetric key // _keyIdentifier = keyIdentifier; } #region ProofDescriptor Overrides /// /// Basically nothing to write into the RSTR's requested proof token. /// /// public override void ApplyTo( RSTR response ) { if ( response == null ) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "response" ); } // // Nothing else to do for an asymmetric key // } /// /// This is the key identifier that the requestor has provided from the use key. /// This can be echo back inside the saml token if needed. This would be either /// public override SecurityKeyIdentifier KeyIdentifier { get { return _keyIdentifier; } } #endregion } }