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
- StorageFunctionMapping.cs
- AVElementHelper.cs
- SemaphoreFullException.cs
- TableLayoutPanel.cs
- IndentTextWriter.cs
- PnrpPermission.cs
- ProgressBar.cs
- ProfileProvider.cs
- MarkupProperty.cs
- TrackingServices.cs
- PipelineComponent.cs
- AmbientLight.cs
- DataGridCellsPanel.cs
- wmiprovider.cs
- CharEnumerator.cs
- ReplyChannelBinder.cs
- DoubleLinkListEnumerator.cs
- TextEditorLists.cs
- VScrollProperties.cs
- XmlNamespaceDeclarationsAttribute.cs
- mongolianshape.cs
- BufferedWebEventProvider.cs
- HeaderedContentControl.cs
- CardSpacePolicyElement.cs
- PowerStatus.cs
- AccessDataSource.cs
- Thread.cs
- ResourcesBuildProvider.cs
- RemoteWebConfigurationHost.cs
- PeerCustomResolverElement.cs
- ToolboxItem.cs
- ImageCodecInfo.cs
- Typography.cs
- ParameterCollection.cs
- AuthenticationManager.cs
- DictionarySectionHandler.cs
- SequentialWorkflowHeaderFooter.cs
- XmlNamespaceManager.cs
- ObjectIDGenerator.cs
- BinaryConverter.cs
- ArgumentDesigner.xaml.cs
- PropertyGeneratedEventArgs.cs
- DiscoveryRequestHandler.cs
- UserNamePasswordServiceCredential.cs
- SQLDateTime.cs
- WebPartTransformer.cs
- BrowserDefinitionCollection.cs
- XamlSerializer.cs
- XhtmlBasicTextViewAdapter.cs
- SoapElementAttribute.cs
- VideoDrawing.cs
- XmlFormatExtensionPointAttribute.cs
- Track.cs
- TextReader.cs
- InvalidEnumArgumentException.cs
- CancellationHandlerDesigner.cs
- FilterEventArgs.cs
- SeekableMessageNavigator.cs
- ObservableDictionary.cs
- BaseTemplateParser.cs
- DbBuffer.cs
- ImageSourceConverter.cs
- FormView.cs
- shaperfactoryquerycacheentry.cs
- DetailsViewCommandEventArgs.cs
- PermissionSetEnumerator.cs
- PingReply.cs
- StringAnimationBase.cs
- LinkedList.cs
- DbConnectionPool.cs
- SystemIcmpV4Statistics.cs
- MemoryRecordBuffer.cs
- AnimationClockResource.cs
- CacheForPrimitiveTypes.cs
- ExpandedWrapper.cs
- BreakRecordTable.cs
- OracleRowUpdatedEventArgs.cs
- ParseHttpDate.cs
- Metadata.cs
- AutomationAttributeInfo.cs
- X509Logo.cs
- CapacityStreamGeometryContext.cs
- ObjectCacheSettings.cs
- Lookup.cs
- ConsoleKeyInfo.cs
- KeyBinding.cs
- MdiWindowListStrip.cs
- NavigationService.cs
- SocketStream.cs
- RayMeshGeometry3DHitTestResult.cs
- UnSafeCharBuffer.cs
- NoPersistHandle.cs
- ResXDataNode.cs
- DbConnectionHelper.cs
- MemoryRecordBuffer.cs
- ModuleConfigurationInfo.cs
- ISO2022Encoding.cs
- TrustLevel.cs
- ModelEditingScope.cs
- OutputCacheSection.cs