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
- ColorIndependentAnimationStorage.cs
- ChtmlTextBoxAdapter.cs
- SortAction.cs
- SafeThemeHandle.cs
- Automation.cs
- WmiEventSink.cs
- DataGridRow.cs
- isolationinterop.cs
- GeneratedCodeAttribute.cs
- Message.cs
- ProgramNode.cs
- XmlNodeReader.cs
- CLRBindingWorker.cs
- StoragePropertyMapping.cs
- ScrollBar.cs
- Bold.cs
- ResourceAttributes.cs
- SessionStateSection.cs
- KeyConstraint.cs
- ErasingStroke.cs
- TypefaceCollection.cs
- TrackingWorkflowEventArgs.cs
- ProfileSettingsCollection.cs
- TextProperties.cs
- ScriptControl.cs
- RangeBaseAutomationPeer.cs
- Error.cs
- CommentEmitter.cs
- AutoCompleteStringCollection.cs
- OdbcConnectionStringbuilder.cs
- TransformDescriptor.cs
- ExtensionWindowResizeGrip.cs
- BoundField.cs
- DiscoveryVersion.cs
- MenuItemBindingCollection.cs
- IDReferencePropertyAttribute.cs
- ComponentChangedEvent.cs
- RequiredFieldValidator.cs
- FileUtil.cs
- FixedPageStructure.cs
- ToolStripDropDown.cs
- CaseExpr.cs
- GenericIdentity.cs
- ChildChangedEventArgs.cs
- ResourceContainer.cs
- AmbientLight.cs
- CultureSpecificStringDictionary.cs
- GridViewCommandEventArgs.cs
- SByte.cs
- BufferedGraphics.cs
- OptimizerPatterns.cs
- DynamicScriptObject.cs
- InternalUserCancelledException.cs
- GridViewCancelEditEventArgs.cs
- ScaleTransform.cs
- CellParaClient.cs
- SqlCommand.cs
- ObjectRef.cs
- TextEditorTyping.cs
- ChannelListenerBase.cs
- RtfToXamlLexer.cs
- RbTree.cs
- _LazyAsyncResult.cs
- SourceChangedEventArgs.cs
- webeventbuffer.cs
- SharedTcpTransportManager.cs
- XmlComment.cs
- DataGridViewAccessibleObject.cs
- XmlEntityReference.cs
- StretchValidation.cs
- ObjectSecurity.cs
- SoapTypeAttribute.cs
- IndicShape.cs
- SoapIncludeAttribute.cs
- FigureHelper.cs
- ObjectKeyFrameCollection.cs
- Point4D.cs
- CodeNamespaceImportCollection.cs
- AdornedElementPlaceholder.cs
- SqlStream.cs
- IOThreadScheduler.cs
- NextPreviousPagerField.cs
- BufferedGraphics.cs
- StrokeSerializer.cs
- TypeValidationEventArgs.cs
- webeventbuffer.cs
- BitmapVisualManager.cs
- PeerDuplexChannel.cs
- DrawToolTipEventArgs.cs
- ContractUtils.cs
- ResolveMatchesApril2005.cs
- MemberAssignmentAnalysis.cs
- Matrix3D.cs
- StrongNameUtility.cs
- CompilerInfo.cs
- CaseStatementProjectedSlot.cs
- FirstQueryOperator.cs
- DataSourceControl.cs
- NetworkInformationException.cs
- SqlBulkCopy.cs