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
- SystemColors.cs
- SpecularMaterial.cs
- RelatedView.cs
- brushes.cs
- IndexedString.cs
- OdbcHandle.cs
- NullEntityWrapper.cs
- CategoryGridEntry.cs
- RepeaterItem.cs
- ControlCollection.cs
- AuditLogLocation.cs
- ArrayElementGridEntry.cs
- EarlyBoundInfo.cs
- WebConfigurationHost.cs
- AppDomainInstanceProvider.cs
- PeerHelpers.cs
- _OSSOCK.cs
- ThreadStateException.cs
- AttachedPropertiesService.cs
- TypefaceCollection.cs
- NameValueFileSectionHandler.cs
- SqlReferenceCollection.cs
- GroupItem.cs
- ToolstripProfessionalRenderer.cs
- ObfuscationAttribute.cs
- SystemFonts.cs
- Int16Storage.cs
- DataViewListener.cs
- CachedTypeface.cs
- SpotLight.cs
- QueryConverter.cs
- ListCollectionView.cs
- DateTime.cs
- DispatcherSynchronizationContext.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- BitmapEffectRenderDataResource.cs
- SqlDataSourceSelectingEventArgs.cs
- InstanceOwnerQueryResult.cs
- SaveFileDialog.cs
- DispatcherHookEventArgs.cs
- CellLabel.cs
- StateMachineWorkflowInstance.cs
- httpserverutility.cs
- X509ChainElement.cs
- Rect3D.cs
- XmlBinaryReader.cs
- RegexWorker.cs
- PathParser.cs
- XamlClipboardData.cs
- Gdiplus.cs
- BitmapCacheBrush.cs
- MemberHolder.cs
- ComplexPropertyEntry.cs
- PagedControl.cs
- ConfigurationUtility.cs
- OdbcEnvironmentHandle.cs
- DefaultProxySection.cs
- Vector.cs
- ActiveXMessageFormatter.cs
- FixedElement.cs
- ReadContentAsBinaryHelper.cs
- SuppressMessageAttribute.cs
- DataRecordObjectView.cs
- Evidence.cs
- XmlSchemaRedefine.cs
- PackageRelationshipSelector.cs
- CmsUtils.cs
- ExpandCollapsePattern.cs
- SessionStateUtil.cs
- TextEndOfLine.cs
- Adorner.cs
- XamlGridLengthSerializer.cs
- TextElementEnumerator.cs
- ListViewSelectEventArgs.cs
- WebPartConnectionsEventArgs.cs
- CodeSnippetTypeMember.cs
- FileSystemInfo.cs
- LogRestartAreaEnumerator.cs
- HybridDictionary.cs
- HttpBufferlessInputStream.cs
- WebPartManagerInternals.cs
- WmlCalendarAdapter.cs
- TypefaceMetricsCache.cs
- PropertyInformationCollection.cs
- TextPattern.cs
- StorageSetMapping.cs
- XmlEventCache.cs
- ZipIOLocalFileDataDescriptor.cs
- AssemblyNameUtility.cs
- SmtpAuthenticationManager.cs
- SoapInteropTypes.cs
- BitmapEffect.cs
- ProcessModelInfo.cs
- ToolStripPanel.cs
- RoleServiceManager.cs
- SoapReflector.cs
- DescriptionAttribute.cs
- ColumnBinding.cs
- LayoutEditorPart.cs
- UriExt.cs