Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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); } } } // 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
- CLSCompliantAttribute.cs
- Globals.cs
- LayoutTableCell.cs
- ComponentResourceKey.cs
- Int32CollectionValueSerializer.cs
- XsltException.cs
- DataViewManager.cs
- ZipIOBlockManager.cs
- CodeConstructor.cs
- TextEncodedRawTextWriter.cs
- CompiledXpathExpr.cs
- SHA512Cng.cs
- PathTooLongException.cs
- DoubleCollectionValueSerializer.cs
- dsa.cs
- Switch.cs
- RegexCharClass.cs
- Page.cs
- FileDialogCustomPlace.cs
- WindowsHyperlink.cs
- X509ChainPolicy.cs
- InfoCardServiceInstallComponent.cs
- XmlBufferReader.cs
- X509Utils.cs
- Int16Storage.cs
- IsolatedStoragePermission.cs
- ContainerUIElement3D.cs
- ConnectivityStatus.cs
- BooleanSwitch.cs
- serverconfig.cs
- Content.cs
- ExpressionLexer.cs
- XmlILTrace.cs
- PinnedBufferMemoryStream.cs
- DragCompletedEventArgs.cs
- ApplicationServiceManager.cs
- OleDbWrapper.cs
- WebColorConverter.cs
- DbCommandTree.cs
- LayoutEditorPart.cs
- FileSystemEventArgs.cs
- ArrayList.cs
- RotateTransform3D.cs
- XsdDataContractExporter.cs
- CodeMemberField.cs
- RequestSecurityTokenForRemoteTokenFactory.cs
- TimelineGroup.cs
- SyntaxCheck.cs
- VerificationException.cs
- WS2007FederationHttpBindingCollectionElement.cs
- PerSessionInstanceContextProvider.cs
- IPAddress.cs
- DataServiceEntityAttribute.cs
- OleDbInfoMessageEvent.cs
- XPathDocumentIterator.cs
- GestureRecognitionResult.cs
- WebPartMovingEventArgs.cs
- SingleResultAttribute.cs
- ContractInferenceHelper.cs
- BitmapInitialize.cs
- SoundPlayer.cs
- SchemaAttDef.cs
- OdbcUtils.cs
- DbConnectionPool.cs
- Component.cs
- TextElementCollection.cs
- NavigationPropertyEmitter.cs
- EncoderParameters.cs
- ServiceOperationParameter.cs
- _SSPIWrapper.cs
- SystemFonts.cs
- COM2PictureConverter.cs
- ExpressionBinding.cs
- DataGridViewSelectedCellCollection.cs
- LongMinMaxAggregationOperator.cs
- NetworkInterface.cs
- FixedPageAutomationPeer.cs
- JsonReaderDelegator.cs
- BuildProvidersCompiler.cs
- CodeDOMProvider.cs
- TdsParser.cs
- TreeNodeCollection.cs
- Configuration.cs
- ControlType.cs
- ping.cs
- PathSegment.cs
- PerspectiveCamera.cs
- UInt64.cs
- GroupJoinQueryOperator.cs
- _NegotiateClient.cs
- QueryExpression.cs
- TextRangeAdaptor.cs
- ProjectionCamera.cs
- EndpointDiscoveryMetadata.cs
- ExtensionFile.cs
- InvokeGenerator.cs
- Int16KeyFrameCollection.cs
- ObjectComplexPropertyMapping.cs
- SqlTypeConverter.cs
- ErasingStroke.cs