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
- StoryFragments.cs
- BitmapEffect.cs
- DynamicDataManager.cs
- SafeProcessHandle.cs
- ProfileModule.cs
- WebScriptMetadataMessageEncoderFactory.cs
- SoapSchemaMember.cs
- ConfigurationProperty.cs
- ImageDrawing.cs
- _CommandStream.cs
- BStrWrapper.cs
- TableAutomationPeer.cs
- GradientStop.cs
- EntityViewGenerationAttribute.cs
- LinkButton.cs
- XmlDataSourceNodeDescriptor.cs
- MenuItemAutomationPeer.cs
- PointIndependentAnimationStorage.cs
- HtmlTernaryTree.cs
- MetadataUtilsSmi.cs
- TdsRecordBufferSetter.cs
- ResourceBinder.cs
- TemplateControlCodeDomTreeGenerator.cs
- ObjectViewListener.cs
- DataGridItemCollection.cs
- XPathNode.cs
- XsltConvert.cs
- TrackingQueryElement.cs
- PartitionResolver.cs
- CheckedPointers.cs
- EntryPointNotFoundException.cs
- CurrentChangedEventManager.cs
- PreviewPageInfo.cs
- CodeNamespaceImport.cs
- FormClosedEvent.cs
- SiteMapPathDesigner.cs
- SiteMapSection.cs
- SessionIDManager.cs
- ConfigurationValues.cs
- ErrorsHelper.cs
- ExtensionQuery.cs
- ConfigurationSection.cs
- WS2007HttpBindingElement.cs
- AppearanceEditorPart.cs
- KeyInfo.cs
- ListBindableAttribute.cs
- Msec.cs
- InvariantComparer.cs
- AxHost.cs
- BulletedList.cs
- TextBoxAutoCompleteSourceConverter.cs
- GenericPrincipal.cs
- DataGridViewLinkCell.cs
- DoubleAnimation.cs
- PartitionedStream.cs
- DynamicUpdateCommand.cs
- WSSecurityJan2004.cs
- CaseExpr.cs
- StreamWriter.cs
- MsmqDiagnostics.cs
- EndpointBehaviorElement.cs
- LinqDataSourceInsertEventArgs.cs
- IgnoreSection.cs
- XmlWriterDelegator.cs
- __Filters.cs
- NetworkStream.cs
- NavigateEvent.cs
- DeviceContext.cs
- UnknownBitmapDecoder.cs
- HostingEnvironmentSection.cs
- MailSettingsSection.cs
- OracleParameter.cs
- ProgressiveCrcCalculatingStream.cs
- TextEffect.cs
- SamlAuthenticationStatement.cs
- WebControl.cs
- EventMetadata.cs
- RootProfilePropertySettingsCollection.cs
- HashRepartitionStream.cs
- ParameterCollectionEditor.cs
- RoleManagerEventArgs.cs
- glyphs.cs
- UserControlDesigner.cs
- FormsAuthenticationConfiguration.cs
- DiscardableAttribute.cs
- HtmlTable.cs
- ViewManagerAttribute.cs
- RowVisual.cs
- XmlChildNodes.cs
- WebPartAuthorizationEventArgs.cs
- ContextMarshalException.cs
- WorkflowRuntimeServiceElementCollection.cs
- SQLInt16.cs
- DispatchChannelSink.cs
- DaylightTime.cs
- TdsParser.cs
- FileUtil.cs
- HostedHttpTransportManager.cs
- LazyTextWriterCreator.cs
- XPathAncestorIterator.cs