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
- ResXFileRef.cs
- ParseNumbers.cs
- ArrayList.cs
- QilFunction.cs
- DefinitionUpdate.cs
- ActionFrame.cs
- SubclassTypeValidatorAttribute.cs
- StructuralObject.cs
- EnumMember.cs
- ZoneButton.cs
- SafeLibraryHandle.cs
- PropertyPathWorker.cs
- milexports.cs
- Thumb.cs
- DetailsViewInsertEventArgs.cs
- SmtpLoginAuthenticationModule.cs
- ButtonChrome.cs
- BuilderInfo.cs
- UpdatePanel.cs
- RuleSetCollection.cs
- DateTimeValueSerializerContext.cs
- ProxyFragment.cs
- Registry.cs
- DisplayNameAttribute.cs
- SelectionManager.cs
- InstanceDataCollection.cs
- TemplateNodeContextMenu.cs
- PointHitTestParameters.cs
- DateTimeEditor.cs
- TagPrefixInfo.cs
- Privilege.cs
- CurrentChangingEventArgs.cs
- WeakHashtable.cs
- OperatingSystem.cs
- SemanticTag.cs
- SignerInfo.cs
- AnchoredBlock.cs
- PolicyException.cs
- QueueSurrogate.cs
- RegularExpressionValidator.cs
- FlowLayoutSettings.cs
- DispatcherHooks.cs
- SubtreeProcessor.cs
- FrugalList.cs
- TextEffectCollection.cs
- isolationinterop.cs
- IntSecurity.cs
- MappedMetaModel.cs
- AsyncContentLoadedEventArgs.cs
- RealizationContext.cs
- HwndHost.cs
- ToRequest.cs
- AssemblyBuilder.cs
- RootProjectionNode.cs
- SourceSwitch.cs
- HandlerBase.cs
- VolatileEnlistmentState.cs
- CodeSnippetExpression.cs
- ColorKeyFrameCollection.cs
- RenderData.cs
- SafeFileMappingHandle.cs
- RangeBaseAutomationPeer.cs
- SchemaCollectionCompiler.cs
- DiagnosticSection.cs
- SqlEnums.cs
- BindingOperations.cs
- BamlReader.cs
- InstanceCreationEditor.cs
- RankException.cs
- TypeGeneratedEventArgs.cs
- SourceFileInfo.cs
- VirtualDirectoryMapping.cs
- ChildChangedEventArgs.cs
- CustomAttributeFormatException.cs
- PageContentCollection.cs
- Label.cs
- TransportConfigurationTypeElement.cs
- Transactions.cs
- StrokeSerializer.cs
- HostedBindingBehavior.cs
- codemethodreferenceexpression.cs
- StylusButton.cs
- XmlSchemaValidationException.cs
- XmlFormatExtensionPointAttribute.cs
- EncryptedPackageFilter.cs
- ConfigUtil.cs
- SqlNotificationRequest.cs
- MonthChangedEventArgs.cs
- GlobalProxySelection.cs
- SqlReorderer.cs
- Rfc2898DeriveBytes.cs
- PerformanceCountersElement.cs
- XmlCompatibilityReader.cs
- SiteIdentityPermission.cs
- AliasGenerator.cs
- Parameter.cs
- _HTTPDateParse.cs
- Int32RectConverter.cs
- SafeRightsManagementPubHandle.cs
- PointCollection.cs