Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / Security / Cryptography / RSAPKCS1KeyExchangeDeformatter.cs / 1 / RSAPKCS1KeyExchangeDeformatter.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class RSAPKCS1KeyExchangeDeformatter : AsymmetricKeyExchangeDeformatter { RSA _rsaKey; RandomNumberGenerator RngValue; // Constructors public RSAPKCS1KeyExchangeDeformatter() {} public RSAPKCS1KeyExchangeDeformatter(AsymmetricAlgorithm key) { if (key == null) throw new ArgumentNullException("key"); _rsaKey = (RSA) key; } // // public properties // public RandomNumberGenerator RNG { get { return RngValue; } set { RngValue = value; } } public override String Parameters { get { return null; } set { ;} } // // public methods // public override byte[] DecryptKeyExchange(byte[] rgbIn) { if (_rsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); byte[] rgbOut; if (_rsaKey is RSACryptoServiceProvider) { rgbOut = ((RSACryptoServiceProvider) _rsaKey).Decrypt(rgbIn, false); } else { int i; byte[] rgb; rgb = _rsaKey.DecryptValue(rgbIn); // // Expected format is: // 00 || 02 || PS || 00 || D // where PS does not contain any zeros. // for (i = 2; i= rgb.Length) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_PKCS1Decoding")); i++; // Skip over the zero rgbOut = new byte[rgb.Length - i]; Buffer.InternalBlockCopy(rgb, i, rgbOut, 0, rgbOut.Length); } return rgbOut; } public override void SetKey(AsymmetricAlgorithm key) { if (key == null) throw new ArgumentNullException("key"); _rsaKey = (RSA) key; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- InfoCardAsymmetricCrypto.cs
- Int32.cs
- SecureEnvironment.cs
- ToolStripOverflow.cs
- ProxyGenerator.cs
- SoundPlayer.cs
- CaseExpr.cs
- ControlsConfig.cs
- CodeStatement.cs
- EndPoint.cs
- CompositeActivityValidator.cs
- ProtectedProviderSettings.cs
- ThicknessAnimationBase.cs
- TrustManager.cs
- WMICapabilities.cs
- ToolStripActionList.cs
- TransformFinalBlockRequest.cs
- TextRunCacheImp.cs
- PermissionSetTriple.cs
- TransactedBatchingBehavior.cs
- SkewTransform.cs
- FileCodeGroup.cs
- HostingEnvironmentSection.cs
- ValidationEventArgs.cs
- HostedImpersonationContext.cs
- Delegate.cs
- DataServiceException.cs
- PictureBox.cs
- PreProcessor.cs
- ModelFactory.cs
- QueryAsyncResult.cs
- StringComparer.cs
- IgnoreFileBuildProvider.cs
- TextCharacters.cs
- RadioButtonDesigner.cs
- SR.cs
- MappingItemCollection.cs
- SafeRegistryHandle.cs
- ResourceReferenceExpression.cs
- DecimalAnimationBase.cs
- FontCollection.cs
- DataSourceXmlSerializationAttribute.cs
- UnmanagedMarshal.cs
- EastAsianLunisolarCalendar.cs
- activationcontext.cs
- KnownIds.cs
- DataSourceHelper.cs
- NetCodeGroup.cs
- RegistrySecurity.cs
- ActivationServices.cs
- DiagnosticsConfiguration.cs
- HttpHostedTransportConfiguration.cs
- BaseAsyncResult.cs
- ApplicationServiceHelper.cs
- WindowsAuthenticationModule.cs
- InputBinder.cs
- TaskHelper.cs
- AuthenticatedStream.cs
- ObjectStorage.cs
- ContentPlaceHolder.cs
- MexTcpBindingCollectionElement.cs
- SimpleNameService.cs
- ExtensionDataObject.cs
- InteropBitmapSource.cs
- SizeAnimationBase.cs
- ResourceReferenceKeyNotFoundException.cs
- CultureInfo.cs
- followingsibling.cs
- DBConcurrencyException.cs
- FixedMaxHeap.cs
- QueryStringParameter.cs
- CompilerError.cs
- ObjectCacheHost.cs
- FileEnumerator.cs
- ListViewDeleteEventArgs.cs
- PageScaling.cs
- WebBrowserEvent.cs
- SecureStringHasher.cs
- TextDecoration.cs
- PtsContext.cs
- ManagementEventArgs.cs
- hresults.cs
- ParameterCollection.cs
- CodePageUtils.cs
- OracleRowUpdatingEventArgs.cs
- TypeDescriptorFilterService.cs
- TypedReference.cs
- StringConverter.cs
- EmptyControlCollection.cs
- SimpleModelProvider.cs
- HtmlButton.cs
- WebPartConnectionsConfigureVerb.cs
- GridViewItemAutomationPeer.cs
- KnownBoxes.cs
- DataServiceRequest.cs
- FloaterParagraph.cs
- ListChangedEventArgs.cs
- CodeSnippetCompileUnit.cs
- ForeignKeyConstraint.cs
- CalendarDayButton.cs