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
- KeyedHashAlgorithm.cs
- WasHostedComPlusFactory.cs
- EdmTypeAttribute.cs
- GridToolTip.cs
- TouchesOverProperty.cs
- COAUTHINFO.cs
- QueryAccessibilityHelpEvent.cs
- WindowsAuthenticationEventArgs.cs
- FrameworkObject.cs
- XsdBuildProvider.cs
- TextRangeProviderWrapper.cs
- CharacterMetricsDictionary.cs
- RC2.cs
- TextCharacters.cs
- UpDownBase.cs
- ContractReference.cs
- ValidationHelper.cs
- HttpsChannelFactory.cs
- TransformerConfigurationWizardBase.cs
- DocumentXmlWriter.cs
- EntityRecordInfo.cs
- HwndAppCommandInputProvider.cs
- CommandValueSerializer.cs
- handlecollector.cs
- SqlConnectionPoolProviderInfo.cs
- WindowsFont.cs
- FormCollection.cs
- HtmlElementEventArgs.cs
- XslNumber.cs
- NonVisualControlAttribute.cs
- SHA256.cs
- OleDbConnectionInternal.cs
- ChangeBlockUndoRecord.cs
- ObjectTypeMapping.cs
- UTF8Encoding.cs
- SplashScreen.cs
- SelectingProviderEventArgs.cs
- WorkflowLayouts.cs
- TimeSpanStorage.cs
- LoadedOrUnloadedOperation.cs
- ColumnCollection.cs
- XmlBinaryReaderSession.cs
- SettingsPropertyValueCollection.cs
- SvcMapFileSerializer.cs
- WindowInteractionStateTracker.cs
- PropertyGrid.cs
- CompModHelpers.cs
- SubpageParaClient.cs
- ScopedKnownTypes.cs
- URL.cs
- thaishape.cs
- Camera.cs
- AddIn.cs
- FixUp.cs
- SqlBulkCopyColumnMapping.cs
- CapabilitiesUse.cs
- ConnectionPoint.cs
- DataSourceConverter.cs
- SqlMethodCallConverter.cs
- BinaryNode.cs
- X509ScopedServiceCertificateElementCollection.cs
- DependencyPropertyConverter.cs
- Int32EqualityComparer.cs
- XmlSchemaIdentityConstraint.cs
- ConfigurationException.cs
- ParseHttpDate.cs
- XsdCachingReader.cs
- CompiledAction.cs
- ControlDesigner.cs
- DataListComponentEditor.cs
- WebPartConnectionsDisconnectVerb.cs
- ConvertTextFrag.cs
- CacheAxisQuery.cs
- Brush.cs
- ExpressionBuilder.cs
- ADMembershipUser.cs
- TemplatedEditableDesignerRegion.cs
- AvTraceFormat.cs
- ConfigurationSettings.cs
- ClientRuntimeConfig.cs
- ValueChangedEventManager.cs
- CharStorage.cs
- SortKey.cs
- InvalidEnumArgumentException.cs
- Assembly.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- PaginationProgressEventArgs.cs
- MouseCaptureWithinProperty.cs
- TypeUtil.cs
- DataControlLinkButton.cs
- LifetimeMonitor.cs
- RelatedImageListAttribute.cs
- WeakReferenceKey.cs
- ConnectionInterfaceCollection.cs
- DelayedRegex.cs
- Gdiplus.cs
- SqlUdtInfo.cs
- StaticResourceExtension.cs
- TextTreeNode.cs
- DefaultAssemblyResolver.cs