Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / TransformFinalBlockRequest.cs / 1 / TransformFinalBlockRequest.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace Microsoft.InfoCards
{
using System;
using System.IO;
using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace;
using System.Security.Principal;
using System.Diagnostics;
//
// Summary:
// Manages an encryption request from the client against a specified cryptosession.
//
class TransformFinalBlockRequest : ClientRequest
{
//
// The cryptosession id we are attaching to.
//
int m_cryptoSession;
//
// The cleartext data we wish to transfrom
//
byte[] m_inBlock;
//
// The transformed data.
//
byte[] m_outBlock;
//
// Sumamry:
// Construct an TransformFinalBlockRequest object
//
// Arguments:
// callingProcess - The process in which the caller originated.
// callingIdentity - The WindowsIdentity of the caller
// rpcHandle - The handle of the native RPC request
// inArgs - The stream to read input data from
// outArgs - The stream to write output data to
//
public TransformFinalBlockRequest( Process callingProcess, WindowsIdentity callingIdentity, IntPtr rpcHandle, Stream inArgs, Stream outArgs )
: base( callingProcess, callingIdentity, rpcHandle, inArgs, outArgs )
{
IDT.TraceDebug( "Intiating an Encrypt request" );
}
protected override void OnMarshalInArgs()
{
IDT.DebugAssert( null != InArgs, "null inargs" );
BinaryReader reader = new InfoCardBinaryReader( InArgs );
m_cryptoSession = reader.ReadInt32();
int count = reader.ReadInt32();
m_inBlock = reader.ReadBytes( count );
IDT.ThrowInvalidArgumentConditional( 0 == m_cryptoSession, "cryptoSession" );
IDT.ThrowInvalidArgumentConditional( null == m_inBlock || 0 == m_inBlock.Length, "inBlock" );
}
//
// Summary:
// Attach to the appropriate cryptosession and encrypt/decrypt the data.
//
protected override void OnProcess()
{
try
{
TransformCryptoSession session =
(TransformCryptoSession) CryptoSession.Find( m_cryptoSession, CallerPid, RequestorIdentity.User );
m_outBlock = session.TransformFinalBlock( m_inBlock );
}
finally
{
Array.Clear( m_inBlock, 0, m_inBlock.Length );
}
}
protected override void OnMarshalOutArgs()
{
IDT.DebugAssert( null != OutArgs, "Null out args" );
IDT.DebugAssert( null != m_outBlock, "null outBlock buffer" );
BinaryWriter writer = new BinaryWriter( OutArgs );
Utility.SerializeBytes( writer, m_outBlock );
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StringUtil.cs
- LinqDataSourceView.cs
- Main.cs
- DescendentsWalkerBase.cs
- HtmlTitle.cs
- XPathDescendantIterator.cs
- IssuanceLicense.cs
- Message.cs
- CodeTypeMember.cs
- InfoCardSymmetricCrypto.cs
- NativeWindow.cs
- Perspective.cs
- WebCodeGenerator.cs
- ProfileGroupSettings.cs
- MessageHeaderDescriptionCollection.cs
- ConfigurationSectionHelper.cs
- Journal.cs
- RootBrowserWindowProxy.cs
- Constants.cs
- ComponentEditorPage.cs
- GridViewDeleteEventArgs.cs
- DataAdapter.cs
- ConditionalAttribute.cs
- SqlUserDefinedAggregateAttribute.cs
- FormsAuthenticationUser.cs
- EntityTransaction.cs
- _ConnectStream.cs
- DigitShape.cs
- Rectangle.cs
- StrongNameIdentityPermission.cs
- CodeNamespaceImportCollection.cs
- SafeNativeMethods.cs
- SourceElementsCollection.cs
- _BasicClient.cs
- FloaterParagraph.cs
- SqlUserDefinedTypeAttribute.cs
- XmlUtil.cs
- SharedDp.cs
- TableLayoutStyle.cs
- DataContractSerializerOperationFormatter.cs
- URLAttribute.cs
- TextElementEditingBehaviorAttribute.cs
- Inflater.cs
- Cell.cs
- StorageSetMapping.cs
- EditingMode.cs
- SqlUtils.cs
- OleDbConnectionInternal.cs
- DataControlFieldCollection.cs
- ApplicationServiceHelper.cs
- MessageSmuggler.cs
- PairComparer.cs
- PolicyException.cs
- ExpressionBindingsDialog.cs
- InputGestureCollection.cs
- ObsoleteAttribute.cs
- SqlNotificationRequest.cs
- MultiPropertyDescriptorGridEntry.cs
- DocumentGridContextMenu.cs
- ApplicationSettingsBase.cs
- DataKey.cs
- ObjRef.cs
- StateManagedCollection.cs
- FormsAuthenticationCredentials.cs
- NotFiniteNumberException.cs
- DSGeneratorProblem.cs
- PropertyTabChangedEvent.cs
- Int64Storage.cs
- NotificationContext.cs
- ApplicationSecurityManager.cs
- CancellationToken.cs
- EditorZone.cs
- WebPartCancelEventArgs.cs
- DataTableNewRowEvent.cs
- FileDialog.cs
- Msec.cs
- FontInfo.cs
- GZipDecoder.cs
- TextBoxRenderer.cs
- GridViewItemAutomationPeer.cs
- DataControlField.cs
- SecurityKeyEntropyMode.cs
- ReachFixedPageSerializerAsync.cs
- InvokePatternIdentifiers.cs
- Model3DGroup.cs
- MSAAWinEventWrap.cs
- MarshalByValueComponent.cs
- TextEffectCollection.cs
- FirstMatchCodeGroup.cs
- TextSelection.cs
- JsonByteArrayDataContract.cs
- Utils.cs
- SelectedCellsChangedEventArgs.cs
- SystemIcmpV6Statistics.cs
- ParenthesizePropertyNameAttribute.cs
- AsyncCompletedEventArgs.cs
- SafeCoTaskMem.cs
- SystemInformation.cs
- ToolboxCategoryItems.cs
- FileChangesMonitor.cs