Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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); } } } // 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
- CopyOfAction.cs
- RowSpanVector.cs
- CodeSnippetStatement.cs
- UTF7Encoding.cs
- TypeElement.cs
- ToolBarTray.cs
- TriState.cs
- TrackingServices.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- CssTextWriter.cs
- GridLength.cs
- LabelInfo.cs
- SqlDependencyListener.cs
- ToolStripItem.cs
- ISAPIRuntime.cs
- PlatformNotSupportedException.cs
- ApplicationSecurityInfo.cs
- StandardBindingReliableSessionElement.cs
- DirectionalLight.cs
- MediaPlayer.cs
- ImageCodecInfo.cs
- VectorAnimation.cs
- SchemaElement.cs
- TreeViewImageGenerator.cs
- SafeBitVector32.cs
- XPathAncestorIterator.cs
- UnSafeCharBuffer.cs
- Selector.cs
- ServicesExceptionNotHandledEventArgs.cs
- CalendarDay.cs
- SourceSwitch.cs
- DelegateHelpers.Generated.cs
- ListMarkerLine.cs
- FunctionImportMapping.cs
- HttpGetServerProtocol.cs
- EntitySqlException.cs
- PersonalizablePropertyEntry.cs
- TdsParserStateObject.cs
- ToolStripButton.cs
- HtmlInputButton.cs
- ProxyGenerator.cs
- SerTrace.cs
- MembershipValidatePasswordEventArgs.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- XmlReaderSettings.cs
- RectValueSerializer.cs
- Selector.cs
- DataColumnMappingCollection.cs
- ZipIOExtraField.cs
- CharStorage.cs
- ModelServiceImpl.cs
- ContentType.cs
- ButtonField.cs
- XmlSchemaChoice.cs
- X509Certificate.cs
- XmlAttributeCache.cs
- ResourceDictionaryCollection.cs
- BoundColumn.cs
- DrawListViewColumnHeaderEventArgs.cs
- FormViewRow.cs
- LinkClickEvent.cs
- FontStretch.cs
- HttpRequest.cs
- ReadOnlyNameValueCollection.cs
- ScrollChrome.cs
- InstanceDataCollection.cs
- AmbientProperties.cs
- ValueExpressions.cs
- ColumnResizeAdorner.cs
- BuildResultCache.cs
- ImageCodecInfoPrivate.cs
- FileReader.cs
- LinqDataSourceHelper.cs
- Image.cs
- SQLConvert.cs
- ClientUIRequest.cs
- XmlAttributes.cs
- SpecialNameAttribute.cs
- ClientTarget.cs
- RijndaelManagedTransform.cs
- ProfileService.cs
- GridView.cs
- IdleTimeoutMonitor.cs
- TextProperties.cs
- SoapBinding.cs
- DoubleLink.cs
- RSAOAEPKeyExchangeDeformatter.cs
- TouchEventArgs.cs
- ProcessHostServerConfig.cs
- XPathNavigatorKeyComparer.cs
- ResourceReferenceExpressionConverter.cs
- MaskedTextBoxTextEditorDropDown.cs
- AppDomainFactory.cs
- ListViewGroupItemCollection.cs
- Separator.cs
- ExpressionBinding.cs
- PagesSection.cs
- XmlElementAttribute.cs
- HostingEnvironmentException.cs
- EntitySetBase.cs