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
- SafeMarshalContext.cs
- TagMapInfo.cs
- BinaryObjectReader.cs
- FixedPage.cs
- Classification.cs
- SafeProcessHandle.cs
- ConnectionConsumerAttribute.cs
- AttributeEmitter.cs
- DesignDataSource.cs
- CustomAttributeBuilder.cs
- HashHelper.cs
- XmlDocumentType.cs
- VScrollProperties.cs
- FastEncoder.cs
- CultureNotFoundException.cs
- MarkupCompilePass2.cs
- ThemeableAttribute.cs
- SqlErrorCollection.cs
- SQLDoubleStorage.cs
- ColorMap.cs
- ImageFormatConverter.cs
- BitConverter.cs
- ImageFormatConverter.cs
- CheckBoxAutomationPeer.cs
- ReflectionUtil.cs
- ViewPort3D.cs
- StackBuilderSink.cs
- Point3DCollectionConverter.cs
- ReadOnlyObservableCollection.cs
- ProxyHelper.cs
- UITypeEditor.cs
- DataGridViewRowsAddedEventArgs.cs
- ImageList.cs
- NativeMethods.cs
- ViewPort3D.cs
- WebPartVerb.cs
- HttpCachePolicyWrapper.cs
- EncryptedKey.cs
- ParserHooks.cs
- SerializerProvider.cs
- SqlWebEventProvider.cs
- FactoryGenerator.cs
- ToolStripPanelRenderEventArgs.cs
- IndexingContentUnit.cs
- ObjectAnimationBase.cs
- PathGradientBrush.cs
- ProtectedUri.cs
- _TransmitFileOverlappedAsyncResult.cs
- ArraySegment.cs
- Base64Stream.cs
- AnnotationComponentChooser.cs
- TextBox.cs
- DateTimeUtil.cs
- ColorMatrix.cs
- SettingsContext.cs
- ApplicationServiceManager.cs
- ADRoleFactoryConfiguration.cs
- OleAutBinder.cs
- EntityDataSourceChangingEventArgs.cs
- StrongNameIdentityPermission.cs
- SynchronousChannel.cs
- cookiecontainer.cs
- ReferenceList.cs
- WSSecurityJan2004.cs
- MetadataCollection.cs
- StylusPointPropertyInfoDefaults.cs
- Shared.cs
- PeerFlooder.cs
- StretchValidation.cs
- BindingRestrictions.cs
- PersonalizationStateInfoCollection.cs
- BezierSegment.cs
- DbParameterCollection.cs
- PageAsyncTaskManager.cs
- ReachDocumentReferenceSerializerAsync.cs
- RankException.cs
- ObjectStateManager.cs
- HWStack.cs
- ToolboxComponentsCreatedEventArgs.cs
- sitestring.cs
- GridSplitter.cs
- TextFormatterImp.cs
- TypeSystemProvider.cs
- DeviceContexts.cs
- TreeChangeInfo.cs
- SrgsElementFactory.cs
- HScrollBar.cs
- Select.cs
- FormViewPagerRow.cs
- ListControlConvertEventArgs.cs
- NetworkAddressChange.cs
- JapaneseCalendar.cs
- UnsafeNativeMethods.cs
- Bidi.cs
- _BaseOverlappedAsyncResult.cs
- FillBehavior.cs
- XmlSchemaCollection.cs
- ConstraintConverter.cs
- VirtualPathUtility.cs
- SyndicationCategory.cs