Code:
/ 4.0 / 4.0 / 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.
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
- NavigationProgressEventArgs.cs
- GregorianCalendar.cs
- nulltextnavigator.cs
- ObjectReferenceStack.cs
- RequestTimeoutManager.cs
- HtmlFormParameterWriter.cs
- TypeExtension.cs
- WrappedReader.cs
- DigitShape.cs
- SafeReversePInvokeHandle.cs
- XmlObjectSerializerReadContextComplexJson.cs
- ListViewGroupConverter.cs
- ColorMap.cs
- DataControlFieldCollection.cs
- SecurityState.cs
- Timer.cs
- ResourceReader.cs
- DateTimeUtil.cs
- CustomCategoryAttribute.cs
- UpdateCommand.cs
- PointCollectionValueSerializer.cs
- BoundConstants.cs
- ComponentDispatcher.cs
- ILGenerator.cs
- XmlWrappingReader.cs
- XmlNodeChangedEventManager.cs
- versioninfo.cs
- TrackingMemoryStream.cs
- ComplexObject.cs
- Vector3DAnimationUsingKeyFrames.cs
- ClientBuildManager.cs
- SpeakProgressEventArgs.cs
- ContextBase.cs
- Span.cs
- Visitors.cs
- CopyNodeSetAction.cs
- Persist.cs
- TableHeaderCell.cs
- ApplicationGesture.cs
- InstanceCreationEditor.cs
- CheckPair.cs
- Behavior.cs
- ParsedAttributeCollection.cs
- SafeNativeMethods.cs
- DataGridViewControlCollection.cs
- View.cs
- PolicyValidator.cs
- DbConnectionInternal.cs
- ValidatorCompatibilityHelper.cs
- ClientFormsAuthenticationCredentials.cs
- ReadOnlyPropertyMetadata.cs
- _RequestCacheProtocol.cs
- HttpFileCollection.cs
- SrgsDocumentParser.cs
- RedistVersionInfo.cs
- BindingWorker.cs
- ReadOnlyDictionary.cs
- HttpHandlersSection.cs
- Visual3DCollection.cs
- TrackingServices.cs
- WebCategoryAttribute.cs
- TransactionManager.cs
- DataGridCellEditEndingEventArgs.cs
- ChildrenQuery.cs
- StackOverflowException.cs
- ReaderWriterLockWrapper.cs
- ServiceObjectContainer.cs
- ControlSerializer.cs
- PartitionResolver.cs
- SerializationEventsCache.cs
- ArraySortHelper.cs
- RegistrationServices.cs
- ListInitExpression.cs
- MutexSecurity.cs
- DataColumn.cs
- Calendar.cs
- TypeExtensionConverter.cs
- Renderer.cs
- MemberMaps.cs
- CornerRadiusConverter.cs
- HitTestWithPointDrawingContextWalker.cs
- Evaluator.cs
- XsltLoader.cs
- Size.cs
- FormatConvertedBitmap.cs
- PKCS1MaskGenerationMethod.cs
- Delegate.cs
- WebBrowserPermission.cs
- IBuiltInEvidence.cs
- HintTextMaxWidthConverter.cs
- UnSafeCharBuffer.cs
- XmlUtil.cs
- FrameworkObject.cs
- WorkflowDebuggerSteppingAttribute.cs
- Icon.cs
- ConfigurationElementProperty.cs
- AttributeInfo.cs
- SelectionItemProviderWrapper.cs
- TextContainerChangeEventArgs.cs
- Command.cs