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
- GlobalItem.cs
- Reference.cs
- TextEditorDragDrop.cs
- WizardForm.cs
- EntityCommandDefinition.cs
- PrinterResolution.cs
- RadioButtonStandardAdapter.cs
- AutoScrollHelper.cs
- GridViewUpdateEventArgs.cs
- Rfc4050KeyFormatter.cs
- GeneratedCodeAttribute.cs
- DeviceContext2.cs
- XomlDesignerLoader.cs
- OdbcStatementHandle.cs
- XmlSchemaProviderAttribute.cs
- RootBrowserWindowProxy.cs
- DbConnectionClosed.cs
- XamlToRtfWriter.cs
- DataGridViewRowCancelEventArgs.cs
- ComponentFactoryHelpers.cs
- StreamingContext.cs
- PeerCustomResolverElement.cs
- RequestTimeoutManager.cs
- ModifiableIteratorCollection.cs
- LicenseContext.cs
- SettingsAttributes.cs
- RecognizerInfo.cs
- DrawTreeNodeEventArgs.cs
- FileUtil.cs
- RefExpr.cs
- OrderedDictionary.cs
- PageAsyncTask.cs
- XamlStackWriter.cs
- CodeNamespaceImport.cs
- MemberCollection.cs
- _OverlappedAsyncResult.cs
- CompilerInfo.cs
- BitmapEffectDrawingContextState.cs
- ListParaClient.cs
- PersonalizableTypeEntry.cs
- SerializationFieldInfo.cs
- HitTestParameters.cs
- DataTableReaderListener.cs
- StoreAnnotationsMap.cs
- CompoundFileStreamReference.cs
- XmlSignatureProperties.cs
- AsyncCodeActivity.cs
- Point3DCollection.cs
- ThreadStartException.cs
- QueuedDeliveryRequirementsMode.cs
- InvokeHandlers.cs
- XamlToRtfWriter.cs
- CDSCollectionETWBCLProvider.cs
- WebConfigurationHostFileChange.cs
- WebConfigurationHost.cs
- ConfigXmlElement.cs
- BindingRestrictions.cs
- SwitchElementsCollection.cs
- SQLBinaryStorage.cs
- ImageIndexConverter.cs
- FileCodeGroup.cs
- ADMembershipUser.cs
- ExtenderControl.cs
- RuntimeWrappedException.cs
- TagPrefixAttribute.cs
- OleDbEnumerator.cs
- WebEventTraceProvider.cs
- CompilerWrapper.cs
- PropertySourceInfo.cs
- MessagePropertyDescription.cs
- AccessViolationException.cs
- CheckBoxFlatAdapter.cs
- SafeProcessHandle.cs
- WindowsScrollBar.cs
- RawStylusActions.cs
- ModelProperty.cs
- CustomErrorsSection.cs
- HtmlControlPersistable.cs
- WindowHideOrCloseTracker.cs
- MessagePropertyFilter.cs
- InkCanvasFeedbackAdorner.cs
- cookie.cs
- NavigatorInput.cs
- PanningMessageFilter.cs
- SafeNativeMethods.cs
- RadioButtonBaseAdapter.cs
- WindowsListViewGroup.cs
- SmiEventSink.cs
- Int64Storage.cs
- WizardStepBase.cs
- ModelItemExtensions.cs
- webbrowsersite.cs
- UIntPtr.cs
- RIPEMD160Managed.cs
- COM2IPerPropertyBrowsingHandler.cs
- SafeSecurityHandles.cs
- TraceContextEventArgs.cs
- SynchronizedInputHelper.cs
- documentsequencetextcontainer.cs
- RegisteredHiddenField.cs