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
- BinHexDecoder.cs
- HtmlGenericControl.cs
- ShutDownListener.cs
- XamlPathDataSerializer.cs
- LogicalExpr.cs
- ObjectStateFormatter.cs
- CapabilitiesSection.cs
- XmlWriter.cs
- COM2TypeInfoProcessor.cs
- _TransmitFileOverlappedAsyncResult.cs
- NextPreviousPagerField.cs
- CodeGroup.cs
- RequestQueue.cs
- Calendar.cs
- SoapAttributeAttribute.cs
- ChangeBlockUndoRecord.cs
- VolatileEnlistmentMultiplexing.cs
- metadatamappinghashervisitor.cs
- DescendentsWalkerBase.cs
- BaseContextMenu.cs
- PerspectiveCamera.cs
- Single.cs
- HighlightComponent.cs
- x509store.cs
- querybuilder.cs
- SRDisplayNameAttribute.cs
- RelatedImageListAttribute.cs
- PopOutPanel.cs
- OdbcCommandBuilder.cs
- HelpOperationInvoker.cs
- AuthenticationServiceManager.cs
- ConnectionManagementElement.cs
- TypeDescriptionProviderAttribute.cs
- RegexWorker.cs
- RijndaelManagedTransform.cs
- InfoCardBaseException.cs
- XmlSchemaExporter.cs
- QueryLifecycle.cs
- PropertyTabChangedEvent.cs
- ContentControl.cs
- GrammarBuilder.cs
- PropertyGridCommands.cs
- PropertyChangedEventManager.cs
- PartialTrustHelpers.cs
- CqlQuery.cs
- GeometryDrawing.cs
- Form.cs
- _Semaphore.cs
- HistoryEventArgs.cs
- VScrollProperties.cs
- InOutArgumentConverter.cs
- BindableAttribute.cs
- TraceProvider.cs
- CommandValueSerializer.cs
- OLEDB_Util.cs
- BrushConverter.cs
- PropertyInfoSet.cs
- SQLInt32Storage.cs
- ValueTypeFixupInfo.cs
- HtmlInputFile.cs
- QilFactory.cs
- DbConnectionStringCommon.cs
- NewExpression.cs
- StringUtil.cs
- SqlBooleanMismatchVisitor.cs
- SharedStatics.cs
- BoundConstants.cs
- CategoryGridEntry.cs
- Viewport2DVisual3D.cs
- ToolStripItemRenderEventArgs.cs
- SQLDouble.cs
- Privilege.cs
- FrameworkTextComposition.cs
- EntityContainerRelationshipSet.cs
- SqlNodeAnnotation.cs
- AudioFormatConverter.cs
- ModelVisual3D.cs
- MenuItem.cs
- MsmqIntegrationBindingElement.cs
- TreeNode.cs
- GeneralTransform3DCollection.cs
- XmlComplianceUtil.cs
- InputScopeManager.cs
- DockProviderWrapper.cs
- ThemeableAttribute.cs
- IntSecurity.cs
- TextDecorations.cs
- Hex.cs
- XmlQuerySequence.cs
- BitmapCodecInfoInternal.cs
- TextAction.cs
- WeakReferenceEnumerator.cs
- LayoutEditorPart.cs
- UpdateCommandGenerator.cs
- ManagementException.cs
- ToolStripDropDownItem.cs
- StreamInfo.cs
- Model3DGroup.cs
- RestClientProxyHandler.cs
- __Error.cs