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
- SharedStatics.cs
- Win32Native.cs
- ColumnReorderedEventArgs.cs
- StartFileNameEditor.cs
- OdbcConnectionStringbuilder.cs
- KeyInfo.cs
- Scheduling.cs
- ReflectEventDescriptor.cs
- SqlFunctionAttribute.cs
- CompoundFileReference.cs
- FontStyleConverter.cs
- XamlFigureLengthSerializer.cs
- WebPartMinimizeVerb.cs
- DataServiceRequest.cs
- Int64.cs
- FilterQueryOptionExpression.cs
- ModelTreeEnumerator.cs
- CompilerCollection.cs
- TraceEventCache.cs
- SqlBooleanMismatchVisitor.cs
- CharacterString.cs
- ColumnPropertiesGroup.cs
- Drawing.cs
- IncrementalReadDecoders.cs
- ViewBase.cs
- DependentList.cs
- ComboBox.cs
- ActivityBindForm.Designer.cs
- ObjectIDGenerator.cs
- DictionaryEditChange.cs
- RegexGroup.cs
- ItemsChangedEventArgs.cs
- PersistChildrenAttribute.cs
- AssemblyAttributesGoHere.cs
- GeneralTransform.cs
- ParallelRangeManager.cs
- SortedList.cs
- DragCompletedEventArgs.cs
- DataGridViewRowCancelEventArgs.cs
- VirtualDirectoryMapping.cs
- ObjectStateManagerMetadata.cs
- ErrorView.xaml.cs
- SystemTcpConnection.cs
- HierarchicalDataTemplate.cs
- Schema.cs
- ManagementObjectSearcher.cs
- SubMenuStyleCollection.cs
- ClientApiGenerator.cs
- DbConnectionClosed.cs
- WorkflowInstanceContextProvider.cs
- DelegateSerializationHolder.cs
- SeverityFilter.cs
- ElementNotAvailableException.cs
- BevelBitmapEffect.cs
- IndexOutOfRangeException.cs
- ComponentChangedEvent.cs
- CheckoutException.cs
- CancelEventArgs.cs
- StringCollectionMarkupSerializer.cs
- HMACRIPEMD160.cs
- PackageStore.cs
- ServiceModelReg.cs
- HostedTcpTransportManager.cs
- Dictionary.cs
- returneventsaver.cs
- MouseWheelEventArgs.cs
- SqlDataRecord.cs
- DocumentApplicationJournalEntry.cs
- ScopedKnownTypes.cs
- QuaternionIndependentAnimationStorage.cs
- MatrixTransform3D.cs
- SafeFileMappingHandle.cs
- TableProviderWrapper.cs
- ConfigurationSectionCollection.cs
- EntityTypeBase.cs
- LambdaCompiler.Address.cs
- WebPartConnectionCollection.cs
- FontSourceCollection.cs
- Cursor.cs
- DaylightTime.cs
- FileSystemEnumerable.cs
- PropertyValueEditor.cs
- PingOptions.cs
- PasswordTextContainer.cs
- RoleManagerSection.cs
- ServiceSecurityAuditBehavior.cs
- Calendar.cs
- XmlSchemaIdentityConstraint.cs
- ToolStrip.cs
- DbConnectionPoolGroupProviderInfo.cs
- ValidationError.cs
- DataBindingExpressionBuilder.cs
- RunInstallerAttribute.cs
- SimpleHandlerBuildProvider.cs
- Reference.cs
- Rijndael.cs
- InlinedLocationReference.cs
- CompositeActivityMarkupSerializer.cs
- AssemblyBuilder.cs
- SessionSymmetricMessageSecurityProtocolFactory.cs