Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / System / Security / Cryptography / RSAOAEPKeyExchangeFormatter.cs / 1 / RSAOAEPKeyExchangeFormatter.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class RSAOAEPKeyExchangeFormatter : AsymmetricKeyExchangeFormatter { private byte[] ParameterValue; private RSA _rsaKey; private RandomNumberGenerator RngValue; // // public constructors // public RSAOAEPKeyExchangeFormatter() {} public RSAOAEPKeyExchangeFormatter(AsymmetricAlgorithm key) { if (key == null) throw new ArgumentNullException("key"); _rsaKey = (RSA) key; } // // public properties // ///public byte[] Parameter { get { if (ParameterValue != null) return (byte[]) ParameterValue.Clone(); return null; } set { if (value != null) ParameterValue = (byte[]) value.Clone(); else ParameterValue = null; } } /// public override String Parameters { get { return null; } } public RandomNumberGenerator Rng { get { return RngValue; } set { RngValue = value; } } // // public methods // public override void SetKey(AsymmetricAlgorithm key) { if (key == null) throw new ArgumentNullException("key"); _rsaKey = (RSA) key; } public override byte[] CreateKeyExchange(byte[] rgbData) { if (_rsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); if (_rsaKey is RSACryptoServiceProvider) { return ((RSACryptoServiceProvider) _rsaKey).Encrypt(rgbData, true); } else { return Utils.RsaOaepEncrypt(_rsaKey, SHA1.Create(), new PKCS1MaskGenerationMethod(), RandomNumberGenerator.Create(), rgbData); } } public override byte[] CreateKeyExchange(byte[] rgbData, Type symAlgType) { return CreateKeyExchange(rgbData); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BaseAddressPrefixFilterElementCollection.cs
- LassoSelectionBehavior.cs
- __TransparentProxy.cs
- CreateParams.cs
- OracleConnectionStringBuilder.cs
- ToolStripArrowRenderEventArgs.cs
- Triplet.cs
- ListView.cs
- Rotation3DAnimation.cs
- SchemaHelper.cs
- DifferencingCollection.cs
- WpfKnownTypeInvoker.cs
- ErrorView.xaml.cs
- TransactionBridge.cs
- VoiceInfo.cs
- _ConnectStream.cs
- TrustManager.cs
- BindingNavigator.cs
- HtmlTextArea.cs
- UInt32.cs
- ListBindableAttribute.cs
- AuthorizationContext.cs
- ObjectParameterCollection.cs
- DiagnosticsConfiguration.cs
- TablePattern.cs
- MobileCategoryAttribute.cs
- StorageScalarPropertyMapping.cs
- RootBrowserWindow.cs
- DbCommandDefinition.cs
- FixedSOMPage.cs
- DataColumnChangeEvent.cs
- EntityDesignerDataSourceView.cs
- CannotUnloadAppDomainException.cs
- IntSumAggregationOperator.cs
- RequestCacheManager.cs
- Emitter.cs
- DynamicQueryableWrapper.cs
- AssertSection.cs
- WebSysDescriptionAttribute.cs
- XmlSchemas.cs
- DSASignatureFormatter.cs
- ObjectContextServiceProvider.cs
- PreProcessor.cs
- WindowsTitleBar.cs
- Misc.cs
- WindowsHyperlink.cs
- ResourceBinder.cs
- ExpressionEditorAttribute.cs
- ComplexBindingPropertiesAttribute.cs
- URLMembershipCondition.cs
- EventSinkActivityDesigner.cs
- DefaultTraceListener.cs
- DesignBindingConverter.cs
- Style.cs
- WebControlsSection.cs
- ReliableRequestSessionChannel.cs
- WsatStrings.cs
- Speller.cs
- SEHException.cs
- WebProxyScriptElement.cs
- EnumerationRangeValidationUtil.cs
- ClientSettings.cs
- basenumberconverter.cs
- FrameworkTextComposition.cs
- Comparer.cs
- MethodBuilder.cs
- LoginCancelEventArgs.cs
- XmlQueryStaticData.cs
- XslVisitor.cs
- ParsedAttributeCollection.cs
- DataServiceConfiguration.cs
- FontStretchConverter.cs
- PageCatalogPart.cs
- FormViewDeletedEventArgs.cs
- XmlUtil.cs
- PageRanges.cs
- TextElementCollection.cs
- ClientUtils.cs
- HMACRIPEMD160.cs
- WebPartEditVerb.cs
- RowUpdatingEventArgs.cs
- ControlValuePropertyAttribute.cs
- MdbDataFileEditor.cs
- DataRecord.cs
- DataRecordInfo.cs
- RelativeSource.cs
- CacheOutputQuery.cs
- ClientConvert.cs
- mongolianshape.cs
- SystemPens.cs
- RSAPKCS1KeyExchangeFormatter.cs
- MetricEntry.cs
- StructuralObject.cs
- DialogWindow.cs
- LoginView.cs
- MessageBox.cs
- SmtpNtlmAuthenticationModule.cs
- BypassElementCollection.cs
- ConfigurationErrorsException.cs
- InternalControlCollection.cs