Code:
/ DotNET / DotNET / 8.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
- LogRestartAreaEnumerator.cs
- AdapterUtil.cs
- LinqDataView.cs
- CompositeDataBoundControl.cs
- TableLayoutPanelResizeGlyph.cs
- ProvidersHelper.cs
- SubqueryRules.cs
- XmlParserContext.cs
- XsdCachingReader.cs
- WebBrowserPermission.cs
- Connection.cs
- Events.cs
- RectangleConverter.cs
- WindowsBrush.cs
- BorderGapMaskConverter.cs
- DateBoldEvent.cs
- InstanceStoreQueryResult.cs
- StringStorage.cs
- SqlDataSourceStatusEventArgs.cs
- StrongNameUtility.cs
- WebPartZoneBase.cs
- TextOptionsInternal.cs
- WinFormsSecurity.cs
- NativeMethods.cs
- DynamicControl.cs
- SafeViewOfFileHandle.cs
- XmlSigningNodeWriter.cs
- WebPartExportVerb.cs
- SchemaInfo.cs
- RoleGroupCollection.cs
- CultureInfoConverter.cs
- DetailsViewInsertedEventArgs.cs
- EdmProperty.cs
- Choices.cs
- Table.cs
- ReferencedType.cs
- ManagementObjectCollection.cs
- ToolStripControlHost.cs
- StronglyTypedResourceBuilder.cs
- XmlUtil.cs
- JournalNavigationScope.cs
- CollectionTypeElement.cs
- Rect3DValueSerializer.cs
- TableCell.cs
- SortDescription.cs
- Context.cs
- Resources.Designer.cs
- SqlXmlStorage.cs
- ByteArrayHelperWithString.cs
- AssociatedControlConverter.cs
- ObjectManager.cs
- VirtualDirectoryMappingCollection.cs
- ListBase.cs
- Errors.cs
- EdgeProfileValidation.cs
- NotImplementedException.cs
- ToolBar.cs
- DataColumnChangeEvent.cs
- ListBase.cs
- BuildDependencySet.cs
- XmlEntityReference.cs
- RelatedCurrencyManager.cs
- DoubleLink.cs
- TypeToken.cs
- UserPreferenceChangingEventArgs.cs
- HttpCachePolicyWrapper.cs
- TypeLibConverter.cs
- CharConverter.cs
- EntityDataSource.cs
- AnnotationHelper.cs
- arabicshape.cs
- LiteralDesigner.cs
- MouseGesture.cs
- ResourceManagerWrapper.cs
- ChameleonKey.cs
- CellParagraph.cs
- DbSetClause.cs
- PrimaryKeyTypeConverter.cs
- NamespaceMapping.cs
- DefinitionBase.cs
- GridViewRowPresenter.cs
- ConditionalAttribute.cs
- KoreanLunisolarCalendar.cs
- TagMapCollection.cs
- StickyNoteAnnotations.cs
- AuthenticationModuleElementCollection.cs
- DynamicControl.cs
- HttpModulesSection.cs
- ImmutableCollection.cs
- CompareValidator.cs
- HttpRequestCacheValidator.cs
- FeatureSupport.cs
- MetadataUtilsSmi.cs
- SystemColors.cs
- DataGridViewImageColumn.cs
- IndependentAnimationStorage.cs
- ToolboxItemImageConverter.cs
- StringSorter.cs
- _AutoWebProxyScriptHelper.cs
- XslVisitor.cs