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
- AutomationPatternInfo.cs
- ApplicationSecurityInfo.cs
- ResourceReferenceExpressionConverter.cs
- TypeSystem.cs
- WebPartManager.cs
- FontClient.cs
- Brushes.cs
- SafeFreeMibTable.cs
- AssemblyAttributes.cs
- SqlCacheDependencySection.cs
- GenerateDerivedKeyRequest.cs
- InstanceNotReadyException.cs
- TextRunTypographyProperties.cs
- NamespaceQuery.cs
- EventProperty.cs
- XmlSchemaDocumentation.cs
- BulletedList.cs
- XmlMtomWriter.cs
- WindowInteractionStateTracker.cs
- ServiceThrottle.cs
- xamlnodes.cs
- LocatorManager.cs
- NativeActivityContext.cs
- CompositeFontParser.cs
- ControlIdConverter.cs
- BinaryNode.cs
- ReadOnlyDictionary.cs
- InputLanguageCollection.cs
- StagingAreaInputItem.cs
- RsaSecurityTokenAuthenticator.cs
- WebConfigurationHost.cs
- DynamicControl.cs
- EdmRelationshipRoleAttribute.cs
- EntityContainer.cs
- DocumentViewer.cs
- HwndStylusInputProvider.cs
- WindowInteractionStateTracker.cs
- Track.cs
- SqlNamer.cs
- autovalidator.cs
- AssociatedControlConverter.cs
- DataServiceRequestArgs.cs
- SafeBitVector32.cs
- CompilerScopeManager.cs
- TimelineGroup.cs
- FileLogRecordStream.cs
- MimeTypeMapper.cs
- ChameleonKey.cs
- TcpClientChannel.cs
- CompositionCommandSet.cs
- JavaScriptObjectDeserializer.cs
- EnvironmentPermission.cs
- PrintPageEvent.cs
- EventSinkActivity.cs
- SecurityResources.cs
- DllHostedComPlusServiceHost.cs
- IHttpResponseInternal.cs
- EntityDataSourceWrapperCollection.cs
- WsrmMessageInfo.cs
- LinkButton.cs
- SingleTagSectionHandler.cs
- NativeMethods.cs
- ConsumerConnectionPointCollection.cs
- CustomCredentialPolicy.cs
- ReaderOutput.cs
- PageParser.cs
- MessageSmuggler.cs
- GridViewAutomationPeer.cs
- RelatedPropertyManager.cs
- util.cs
- TimelineCollection.cs
- SqlConnectionStringBuilder.cs
- XamlStream.cs
- DropSource.cs
- SmiEventSink_DeferedProcessing.cs
- ScriptReference.cs
- HeaderUtility.cs
- SessionSwitchEventArgs.cs
- StorageSetMapping.cs
- XmlSerializationReader.cs
- SecurityAlgorithmSuite.cs
- ImageBrush.cs
- CellPartitioner.cs
- PropertySegmentSerializer.cs
- PackageRelationshipSelector.cs
- SQLBoolean.cs
- RemotingConfigParser.cs
- ValidatorAttribute.cs
- SerializationFieldInfo.cs
- StylusPointPropertyInfo.cs
- DurationConverter.cs
- StylusTip.cs
- RectKeyFrameCollection.cs
- SessionEndingEventArgs.cs
- LinearGradientBrush.cs
- DelayDesigner.cs
- EventListenerClientSide.cs
- ProcessHostConfigUtils.cs
- BaseDataBoundControl.cs
- HttpWebRequest.cs