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
- ProgressBarHighlightConverter.cs
- ThousandthOfEmRealPoints.cs
- initElementDictionary.cs
- TraceUtility.cs
- TextRunProperties.cs
- InvalidateEvent.cs
- OutputCacheSection.cs
- ChildrenQuery.cs
- ToolBarButton.cs
- AssemblyInfo.cs
- InvokeProviderWrapper.cs
- ConfigurationManagerHelperFactory.cs
- StylusPlugin.cs
- TdsParserSafeHandles.cs
- UriExt.cs
- JsonDeserializer.cs
- SettingsContext.cs
- DataBinding.cs
- FrameworkContentElement.cs
- ListViewItem.cs
- FunctionOverloadResolver.cs
- TcpChannelHelper.cs
- _Connection.cs
- OdbcException.cs
- WindowsFormsSectionHandler.cs
- VersionedStream.cs
- X509Chain.cs
- PointValueSerializer.cs
- DataBinding.cs
- XmlExpressionDumper.cs
- CodeParameterDeclarationExpressionCollection.cs
- Set.cs
- FilteredXmlReader.cs
- FocusTracker.cs
- GestureRecognitionResult.cs
- AccessDataSource.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- EngineSiteSapi.cs
- EntryPointNotFoundException.cs
- ClrProviderManifest.cs
- ObjectDataSourceMethodEditor.cs
- ServiceContractAttribute.cs
- PersonalizationStateInfoCollection.cs
- DockPatternIdentifiers.cs
- UserControlCodeDomTreeGenerator.cs
- ObjectDataSource.cs
- TdsParserStateObject.cs
- PlanCompiler.cs
- XmlDocumentType.cs
- PerformanceCountersElement.cs
- GregorianCalendar.cs
- OdbcException.cs
- FixedSOMLineCollection.cs
- TextureBrush.cs
- ProcessHostConfigUtils.cs
- RTLAwareMessageBox.cs
- ComponentEvent.cs
- DrawingBrush.cs
- DispatchChannelSink.cs
- CallbackTimeoutsElement.cs
- DBConcurrencyException.cs
- QueryContinueDragEventArgs.cs
- EndEvent.cs
- AttributeProviderAttribute.cs
- LoginName.cs
- WindowsRichEdit.cs
- EncryptedType.cs
- IconHelper.cs
- GraphicsContext.cs
- DeflateStream.cs
- DbProviderFactories.cs
- StrokeIntersection.cs
- Sql8ExpressionRewriter.cs
- WebPartZoneBase.cs
- TreeNodeConverter.cs
- RemotingSurrogateSelector.cs
- MetafileHeaderWmf.cs
- PolyLineSegment.cs
- BridgeDataRecord.cs
- Screen.cs
- Function.cs
- FormView.cs
- BroadcastEventHelper.cs
- XmlCharCheckingReader.cs
- SchemaReference.cs
- WebPartVerbsEventArgs.cs
- ScriptingScriptResourceHandlerSection.cs
- XmlDownloadManager.cs
- GPRECT.cs
- CallbackException.cs
- _CacheStreams.cs
- ExpressionHelper.cs
- XmlQualifiedName.cs
- UnmanagedHandle.cs
- Guid.cs
- XmlSchemaAny.cs
- CompModHelpers.cs
- ObjectStateFormatter.cs
- TypeUtil.cs
- SqlConnection.cs