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
- SqlConnectionStringBuilder.cs
- KeyEvent.cs
- AliasGenerator.cs
- TextElementCollectionHelper.cs
- SqlDataSourceConfigureSortForm.cs
- BitStream.cs
- Stroke2.cs
- FieldBuilder.cs
- DESCryptoServiceProvider.cs
- BuildManagerHost.cs
- ExpandSegmentCollection.cs
- ScrollItemPatternIdentifiers.cs
- TagMapCollection.cs
- SelectionPatternIdentifiers.cs
- ConfigXmlSignificantWhitespace.cs
- LayoutInformation.cs
- EmptyStringExpandableObjectConverter.cs
- MetabaseSettingsIis7.cs
- ListBoxChrome.cs
- AuthorizationRuleCollection.cs
- ServiceOperationInfoTypeConverter.cs
- DelegateHelpers.cs
- SystemIPAddressInformation.cs
- AnnouncementEndpointElement.cs
- SiteOfOriginPart.cs
- EventSetter.cs
- FixedSOMTableRow.cs
- AsymmetricSecurityProtocolFactory.cs
- RelationshipWrapper.cs
- Substitution.cs
- ButtonField.cs
- CodeComment.cs
- ControlIdConverter.cs
- ContractComponent.cs
- PatternMatcher.cs
- DigitShape.cs
- PagedDataSource.cs
- LogicalExpr.cs
- DynamicPhysicalDiscoSearcher.cs
- HyperLinkStyle.cs
- AttachedPropertyInfo.cs
- StyleBamlRecordReader.cs
- LinkLabelLinkClickedEvent.cs
- ConfigXmlSignificantWhitespace.cs
- IPEndPointCollection.cs
- WeakHashtable.cs
- ParameterReplacerVisitor.cs
- Image.cs
- BufferAllocator.cs
- DbConnectionPoolOptions.cs
- CodeConstructor.cs
- FunctionQuery.cs
- ThicknessKeyFrameCollection.cs
- RawMouseInputReport.cs
- FolderLevelBuildProvider.cs
- EnumMember.cs
- DashStyle.cs
- SqlDataSourceRefreshSchemaForm.cs
- RequestSecurityTokenResponseCollection.cs
- EventMappingSettings.cs
- ControlTemplate.cs
- VoiceSynthesis.cs
- CompModSwitches.cs
- SignedXml.cs
- Pkcs7Recipient.cs
- ACE.cs
- ObjectListDataBindEventArgs.cs
- DataControlField.cs
- Debug.cs
- AuthorizationContext.cs
- HttpProtocolReflector.cs
- COMException.cs
- DetailsViewUpdatedEventArgs.cs
- UncommonField.cs
- ZipIOExtraFieldZip64Element.cs
- SubqueryTrackingVisitor.cs
- DoubleConverter.cs
- ConfigDefinitionUpdates.cs
- TypeUnloadedException.cs
- connectionpool.cs
- WebPartManagerInternals.cs
- ItemsControlAutomationPeer.cs
- TemplatingOptionsDialog.cs
- PhonemeEventArgs.cs
- WorkerRequest.cs
- DataGridViewAccessibleObject.cs
- RoutedEventValueSerializer.cs
- CodeExporter.cs
- SqlConnectionHelper.cs
- DropDownHolder.cs
- ListBindingHelper.cs
- ServiceOperationViewControl.cs
- DesignerRegionCollection.cs
- SchemaCollectionCompiler.cs
- EventMappingSettings.cs
- SmtpReplyReaderFactory.cs
- OutputCacheProfileCollection.cs
- CopyNodeSetAction.cs
- DataContractSerializerServiceBehavior.cs
- DesignerAttribute.cs