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
- EditorZone.cs
- ImmutableCollection.cs
- PageHandlerFactory.cs
- RegexTree.cs
- JapaneseLunisolarCalendar.cs
- PeerNameResolver.cs
- UrlPath.cs
- SqlDataSourceConfigureSelectPanel.cs
- DropTarget.cs
- _NetRes.cs
- WindowsToolbarAsMenu.cs
- XmlWellformedWriter.cs
- ScriptingWebServicesSectionGroup.cs
- CollectionBase.cs
- CombinedHttpChannel.cs
- Config.cs
- NTAccount.cs
- BinaryObjectReader.cs
- NullRuntimeConfig.cs
- Config.cs
- ScrollItemPattern.cs
- NamedPipeDuplicateContext.cs
- SafeThreadHandle.cs
- SizeKeyFrameCollection.cs
- SecureStringHasher.cs
- VerificationAttribute.cs
- ColumnCollection.cs
- XmlSchemaImport.cs
- MSHTMLHost.cs
- ProjectedSlot.cs
- DocumentViewerHelper.cs
- ItemContainerGenerator.cs
- QuestionEventArgs.cs
- ScriptControl.cs
- PointKeyFrameCollection.cs
- CodeStatement.cs
- OdbcConnectionString.cs
- xsdvalidator.cs
- ListItem.cs
- WebPartEditorApplyVerb.cs
- DrawingContextDrawingContextWalker.cs
- BackgroundWorker.cs
- _SslSessionsCache.cs
- ObsoleteAttribute.cs
- dbdatarecord.cs
- Clock.cs
- GridEntry.cs
- Setter.cs
- ToolStripButton.cs
- EpmCustomContentSerializer.cs
- XmlSchemaSimpleTypeUnion.cs
- DBAsyncResult.cs
- CannotUnloadAppDomainException.cs
- ConfigViewGenerator.cs
- TemplateXamlParser.cs
- MembershipSection.cs
- FormatStringEditor.cs
- Compiler.cs
- PageHandlerFactory.cs
- ObjectToIdCache.cs
- FontFaceLayoutInfo.cs
- FrameworkReadOnlyPropertyMetadata.cs
- EntityType.cs
- BigInt.cs
- ElementNotAvailableException.cs
- Window.cs
- RadioButtonDesigner.cs
- FilterableAttribute.cs
- FontNamesConverter.cs
- MessageQueueAccessControlEntry.cs
- AdjustableArrowCap.cs
- ImageClickEventArgs.cs
- TextServicesContext.cs
- CryptoStream.cs
- DPTypeDescriptorContext.cs
- RenameRuleObjectDialog.cs
- DataGridViewDesigner.cs
- MemoryStream.cs
- ClientProxyGenerator.cs
- InitializationEventAttribute.cs
- Int64Storage.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- TraceHandler.cs
- Item.cs
- DuplexChannelBinder.cs
- Rotation3DAnimationBase.cs
- CqlLexerHelpers.cs
- DataGridViewElement.cs
- EventLogPermissionEntry.cs
- DesignTimeVisibleAttribute.cs
- XPathSingletonIterator.cs
- AsymmetricAlgorithm.cs
- Roles.cs
- returneventsaver.cs
- WinFormsSecurity.cs
- FormatSettings.cs
- AddInPipelineAttributes.cs
- WebPartMenuStyle.cs
- NotSupportedException.cs
- TextPattern.cs