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
- VectorConverter.cs
- XmlDigitalSignatureProcessor.cs
- ObjectViewFactory.cs
- ContractNamespaceAttribute.cs
- UnsafeNativeMethodsTablet.cs
- MetadataCache.cs
- SqlCharStream.cs
- TypefaceMetricsCache.cs
- SelectionRangeConverter.cs
- DocumentReferenceCollection.cs
- TabRenderer.cs
- CodeTypeReferenceExpression.cs
- Select.cs
- ComponentCollection.cs
- UIElement.cs
- PenThreadPool.cs
- RectangleGeometry.cs
- ActivationArguments.cs
- ConfigurationProperty.cs
- BuildManager.cs
- RealizationDrawingContextWalker.cs
- XmlTextReader.cs
- DataGridViewControlCollection.cs
- SetStoryboardSpeedRatio.cs
- GridViewColumnHeader.cs
- DataGridViewComponentPropertyGridSite.cs
- MeshGeometry3D.cs
- EmbeddedMailObjectsCollection.cs
- RadioButtonPopupAdapter.cs
- Drawing.cs
- ShaderEffect.cs
- HiddenFieldPageStatePersister.cs
- Rectangle.cs
- GroupBox.cs
- DisplayMemberTemplateSelector.cs
- WindowsImpersonationContext.cs
- PathHelper.cs
- MarkerProperties.cs
- IndexerNameAttribute.cs
- SqlRowUpdatingEvent.cs
- ControlAdapter.cs
- LinqDataSourceContextData.cs
- ContentPathSegment.cs
- ResXDataNode.cs
- DodSequenceMerge.cs
- SafeMILHandle.cs
- CacheAxisQuery.cs
- CalendarTable.cs
- MultiViewDesigner.cs
- WebServiceHandlerFactory.cs
- InputLanguageEventArgs.cs
- TagMapCollection.cs
- CodeTypeReferenceCollection.cs
- APCustomTypeDescriptor.cs
- AttributeCollection.cs
- BmpBitmapDecoder.cs
- SafeRightsManagementSessionHandle.cs
- QueryLifecycle.cs
- DataGridViewCellStateChangedEventArgs.cs
- WorkflowRuntimeService.cs
- FileDialogCustomPlacesCollection.cs
- _Semaphore.cs
- ResXDataNode.cs
- DispatcherOperation.cs
- TextMessageEncoder.cs
- TemplateEditingService.cs
- FormViewInsertedEventArgs.cs
- XmlComment.cs
- GacUtil.cs
- ping.cs
- WinHttpWebProxyFinder.cs
- MemberInfoSerializationHolder.cs
- PlainXmlWriter.cs
- ConfigXmlDocument.cs
- PeerObject.cs
- SqlConnectionFactory.cs
- DrawingContextDrawingContextWalker.cs
- ThreadExceptionDialog.cs
- ObjRef.cs
- ClickablePoint.cs
- ReaderOutput.cs
- DataContractSerializerSection.cs
- DelimitedListTraceListener.cs
- UserInitiatedNavigationPermission.cs
- TableLayoutStyle.cs
- ItemsChangedEventArgs.cs
- LoginDesigner.cs
- XmlProcessingInstruction.cs
- _IPv4Address.cs
- FrameworkObject.cs
- TreeViewEvent.cs
- ToolStripManager.cs
- indexingfiltermarshaler.cs
- UrlAuthFailureHandler.cs
- UserMapPath.cs
- mongolianshape.cs
- ActiveXHost.cs
- InternalPermissions.cs
- ConfigurationSectionHelper.cs
- SizeAnimationBase.cs