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
- DateBoldEvent.cs
- TableColumnCollection.cs
- MetadataPropertyAttribute.cs
- Substitution.cs
- DesignTable.cs
- UIElement.cs
- EdmRelationshipRoleAttribute.cs
- XmlSchemaSimpleTypeList.cs
- SQLDateTime.cs
- ZipIOCentralDirectoryFileHeader.cs
- RepeatBehavior.cs
- PopupRoot.cs
- HttpListenerException.cs
- IIS7UserPrincipal.cs
- EdmProperty.cs
- ButtonBase.cs
- CalendarDay.cs
- ComponentResourceKey.cs
- MailAddress.cs
- diagnosticsswitches.cs
- ParserOptions.cs
- DocumentViewer.cs
- StylusButtonEventArgs.cs
- ItemDragEvent.cs
- CqlParser.cs
- ExpressionParser.cs
- OneOfTypeConst.cs
- DataBindingsDialog.cs
- FontFamilyValueSerializer.cs
- BrowsableAttribute.cs
- X509ChainElement.cs
- EntityTypeBase.cs
- DataGridViewSelectedRowCollection.cs
- DataServiceQueryOfT.cs
- AtlasWeb.Designer.cs
- TimeSpanConverter.cs
- TreeIterator.cs
- ContentElement.cs
- AddInProcess.cs
- DataGridViewLinkColumn.cs
- TextComposition.cs
- CopyCodeAction.cs
- AstTree.cs
- CompilationSection.cs
- URLAttribute.cs
- Code.cs
- ToolStripButton.cs
- MetadataWorkspace.cs
- LongValidator.cs
- GenericUriParser.cs
- ThemeableAttribute.cs
- CreateUserWizardStep.cs
- ProtectedConfiguration.cs
- PathFigure.cs
- EditorBrowsableAttribute.cs
- ExitEventArgs.cs
- ProxyElement.cs
- ToolboxBitmapAttribute.cs
- Msec.cs
- WebPartTransformerAttribute.cs
- _AuthenticationState.cs
- FunctionDetailsReader.cs
- Effect.cs
- SecurityIdentifierElement.cs
- FontFaceLayoutInfo.cs
- WinEventQueueItem.cs
- DynamicObjectAccessor.cs
- ProgressBar.cs
- TextTreePropertyUndoUnit.cs
- ManagedWndProcTracker.cs
- AutomationPatternInfo.cs
- RegisteredScript.cs
- HandleCollector.cs
- BulletedListEventArgs.cs
- TreeViewImageIndexConverter.cs
- WmlFormAdapter.cs
- FileLevelControlBuilderAttribute.cs
- CacheHelper.cs
- ValidationErrorCollection.cs
- RootProfilePropertySettingsCollection.cs
- PropertyConverter.cs
- ImplicitInputBrush.cs
- WebBodyFormatMessageProperty.cs
- FlowNode.cs
- DateTimeFormatInfo.cs
- BitmapVisualManager.cs
- DataContractSerializerElement.cs
- httpapplicationstate.cs
- UnitySerializationHolder.cs
- UInt16.cs
- PixelShader.cs
- MessageEncodingBindingElement.cs
- ScaleTransform.cs
- SmtpDigestAuthenticationModule.cs
- HybridDictionary.cs
- DataGridViewLinkColumn.cs
- SqlDataSourceCache.cs
- Int16.cs
- ObjectView.cs
- BasicHttpBinding.cs