Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / Cryptography / RSAOAEPKeyExchangeDeformatter.cs / 1305376 / RSAOAEPKeyExchangeDeformatter.cs
using System.Diagnostics.Contracts;
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// [....]
//
namespace System.Security.Cryptography {
[System.Runtime.InteropServices.ComVisible(true)]
public class RSAOAEPKeyExchangeDeformatter : AsymmetricKeyExchangeDeformatter {
private RSA _rsaKey; // RSA Key value to do decrypt operation
//
// public constructors
//
public RSAOAEPKeyExchangeDeformatter() {}
public RSAOAEPKeyExchangeDeformatter(AsymmetricAlgorithm key) {
if (key == null)
throw new ArgumentNullException("key");
Contract.EndContractBlock();
_rsaKey = (RSA) key;
}
//
// public properties
//
public override String Parameters {
get { return null; }
set { ; }
}
//
// public methods
//
[System.Security.SecuritySafeCritical] // auto-generated
public override byte[] DecryptKeyExchange(byte[] rgbData) {
if (_rsaKey == null)
throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey"));
if (_rsaKey is RSACryptoServiceProvider) {
return ((RSACryptoServiceProvider) _rsaKey).Decrypt(rgbData, true);
} else {
return Utils.RsaOaepDecrypt(_rsaKey, SHA1.Create(), new PKCS1MaskGenerationMethod(), rgbData);
}
}
public override void SetKey(AsymmetricAlgorithm key) {
if (key == null)
throw new ArgumentNullException("key");
Contract.EndContractBlock();
_rsaKey = (RSA) key;
}
}
}
// 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
- IdentityNotMappedException.cs
- PrintingPermission.cs
- CodeTypeMemberCollection.cs
- DesignerCalendarAdapter.cs
- WebPartTransformerAttribute.cs
- ConfigurationValue.cs
- PageOrientation.cs
- ToolStripDesignerUtils.cs
- CodeTypeMemberCollection.cs
- RepeaterItem.cs
- XamlWriter.cs
- _UriSyntax.cs
- LineGeometry.cs
- TypeConstant.cs
- InvokeProviderWrapper.cs
- TraceAsyncResult.cs
- ChtmlFormAdapter.cs
- ClientRolePrincipal.cs
- StateChangeEvent.cs
- SoapAttributeOverrides.cs
- KnownAssembliesSet.cs
- OdbcConnectionHandle.cs
- DynamicActivity.cs
- DataGridViewTextBoxColumn.cs
- UnsafeNativeMethods.cs
- RuntimeVariablesExpression.cs
- DependencyPropertyDescriptor.cs
- EventSource.cs
- TypeForwardedToAttribute.cs
- InvalidComObjectException.cs
- IntSecurity.cs
- SamlConditions.cs
- RoleManagerEventArgs.cs
- RegisteredScript.cs
- SyndicationSerializer.cs
- JoinCqlBlock.cs
- CodeRemoveEventStatement.cs
- WebPartHeaderCloseVerb.cs
- StringFreezingAttribute.cs
- WebPartDescription.cs
- TraceContextEventArgs.cs
- Properties.cs
- HwndPanningFeedback.cs
- WebPartRestoreVerb.cs
- BitmapSizeOptions.cs
- GPPOINT.cs
- SerializerProvider.cs
- WsatStrings.cs
- MultiAsyncResult.cs
- ServiceChannel.cs
- DomNameTable.cs
- ContainerSelectorGlyph.cs
- NativeRightsManagementAPIsStructures.cs
- JumpPath.cs
- ApplicationBuildProvider.cs
- MediaCommands.cs
- HTTPNotFoundHandler.cs
- ParallelDesigner.cs
- NameTable.cs
- CharStorage.cs
- IconHelper.cs
- AnnotationResourceChangedEventArgs.cs
- UInt32.cs
- AssemblyGen.cs
- isolationinterop.cs
- EntityKeyElement.cs
- HttpFormatExtensions.cs
- CqlParserHelpers.cs
- TextPenaltyModule.cs
- EventPrivateKey.cs
- NotifyCollectionChangedEventArgs.cs
- DispatcherExceptionEventArgs.cs
- MachineKeySection.cs
- ExpressionLink.cs
- HandlerBase.cs
- InternalConfigHost.cs
- SmtpTransport.cs
- XmlHierarchyData.cs
- InkCanvasSelection.cs
- ToolStripItemCollection.cs
- TcpSocketManager.cs
- ToolStripProgressBar.cs
- SiteMapNodeItem.cs
- WpfXamlMember.cs
- SQLBytes.cs
- OperandQuery.cs
- MemoryFailPoint.cs
- XmlWellformedWriter.cs
- VectorConverter.cs
- HttpValueCollection.cs
- ReliableRequestSessionChannel.cs
- DataGridViewRowConverter.cs
- PrivilegedConfigurationManager.cs
- _IPv4Address.cs
- PrePostDescendentsWalker.cs
- Storyboard.cs
- ObjectDataSourceEventArgs.cs
- Propagator.cs
- NameObjectCollectionBase.cs
- UnaryNode.cs