//-----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace System.IdentityModel.Protocols.WSTrust
{
///
/// Represents the contents of the BinaryExchange element.
///
public class BinaryExchange
{
byte[] _binaryData;
Uri _valueType;
Uri _encodingType;
///
/// Creates an instance of
///
/// Binary data exchanged.
/// Uri representing the value type of the binary data.
/// Input parameter 'binaryData' or 'valueType' is null.
public BinaryExchange( byte[] binaryData, Uri valueType )
: this( binaryData, valueType, new Uri( WSSecurity10Constants.EncodingTypes.Base64 ) )
{
}
///
/// Creates an instance of
///
/// Binary data exchanged.
/// Uri representing the value type of the binary data.
/// Encoding type to be used for encoding teh
/// Input parameter 'binaryData', 'valueType' or 'encodingType' is null.
public BinaryExchange( byte[] binaryData, Uri valueType, Uri encodingType )
{
if ( binaryData == null )
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "binaryData" );
}
if ( valueType == null )
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "valueType" );
}
if ( encodingType == null )
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "encodingType" );
}
if ( !valueType.IsAbsoluteUri )
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument( "valueType", SR.GetString( SR.ID0013 ) );
}
if ( !encodingType.IsAbsoluteUri )
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument( "encodingType", SR.GetString( SR.ID0013 ) );
}
_binaryData = binaryData;
_valueType = valueType;
_encodingType = encodingType;
}
///
/// Gets the Binary Data.
///
public byte[] BinaryData
{
get { return _binaryData; }
}
///
/// Gets the ValueType Uri.
///
public Uri ValueType
{
get { return _valueType; }
}
///
/// Gets the EncodingType Uri.
///
public Uri EncodingType
{
get { return _encodingType; }
}
}
}