Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / clr / src / BCL / System / Security / Cryptography / RSAOAEPKeyExchangeDeformatter.cs / 1 / RSAOAEPKeyExchangeDeformatter.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
namespace System.Security.Cryptography {
[System.Runtime.InteropServices.ComVisible(true)]
public class RSAOAEPKeyExchangeDeformatter : AsymmetricKeyExchangeDeformatter {
private RSA _rsaKey; // RSA Key value to do decrypt operation
//
// public constructors
//
public RSAOAEPKeyExchangeDeformatter() {}
public RSAOAEPKeyExchangeDeformatter(AsymmetricAlgorithm key) {
if (key == null)
throw new ArgumentNullException("key");
_rsaKey = (RSA) key;
}
//
// public properties
//
public override String Parameters {
get { return null; }
set { ; }
}
//
// public methods
//
public override byte[] DecryptKeyExchange(byte[] rgbData) {
if (_rsaKey == null)
throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey"));
if (_rsaKey is RSACryptoServiceProvider) {
return ((RSACryptoServiceProvider) _rsaKey).Decrypt(rgbData, true);
} else {
return Utils.RsaOaepDecrypt(_rsaKey, SHA1.Create(), new PKCS1MaskGenerationMethod(), rgbData);
}
}
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.
//
// ==--==
namespace System.Security.Cryptography {
[System.Runtime.InteropServices.ComVisible(true)]
public class RSAOAEPKeyExchangeDeformatter : AsymmetricKeyExchangeDeformatter {
private RSA _rsaKey; // RSA Key value to do decrypt operation
//
// public constructors
//
public RSAOAEPKeyExchangeDeformatter() {}
public RSAOAEPKeyExchangeDeformatter(AsymmetricAlgorithm key) {
if (key == null)
throw new ArgumentNullException("key");
_rsaKey = (RSA) key;
}
//
// public properties
//
public override String Parameters {
get { return null; }
set { ; }
}
//
// public methods
//
public override byte[] DecryptKeyExchange(byte[] rgbData) {
if (_rsaKey == null)
throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey"));
if (_rsaKey is RSACryptoServiceProvider) {
return ((RSACryptoServiceProvider) _rsaKey).Decrypt(rgbData, true);
} else {
return Utils.RsaOaepDecrypt(_rsaKey, SHA1.Create(), new PKCS1MaskGenerationMethod(), rgbData);
}
}
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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BaseProcessor.cs
- DocumentXPathNavigator.cs
- dtdvalidator.cs
- TransformConverter.cs
- dataprotectionpermissionattribute.cs
- BitmapSource.cs
- DataGridViewIntLinkedList.cs
- NumericPagerField.cs
- FontSource.cs
- Bits.cs
- BuilderPropertyEntry.cs
- XPathScanner.cs
- StringArrayConverter.cs
- ContainerSelectorBehavior.cs
- HighlightComponent.cs
- FontDialog.cs
- LayoutManager.cs
- WindowsScrollBarBits.cs
- ExpressionNode.cs
- AssociationSetMetadata.cs
- GenericRootAutomationPeer.cs
- DecoderBestFitFallback.cs
- DeviceContexts.cs
- Convert.cs
- FontUnit.cs
- PresentationSource.cs
- HtmlHead.cs
- WindowsListViewGroupHelper.cs
- cookiecollection.cs
- SqlCommand.cs
- UpDownEvent.cs
- DataMisalignedException.cs
- DBSchemaRow.cs
- DecimalConstantAttribute.cs
- SpecularMaterial.cs
- DataServiceExpressionVisitor.cs
- ExceptionWrapper.cs
- BindValidationContext.cs
- RemotingService.cs
- GridViewAutoFormat.cs
- WebPartActionVerb.cs
- Trigger.cs
- DataFieldCollectionEditor.cs
- ZipIOFileItemStream.cs
- ClientFormsAuthenticationMembershipProvider.cs
- CachedBitmap.cs
- DocumentSequenceHighlightLayer.cs
- MissingManifestResourceException.cs
- XmlSortKeyAccumulator.cs
- RegionInfo.cs
- TextDecorationUnitValidation.cs
- DataListItem.cs
- SQLInt32.cs
- ThreadAttributes.cs
- TextRunCache.cs
- SafeHandles.cs
- TransportOutputChannel.cs
- SharedStatics.cs
- JsonMessageEncoderFactory.cs
- System.Data_BID.cs
- MessagePropertyAttribute.cs
- ElementAtQueryOperator.cs
- ExtendedPropertiesHandler.cs
- CryptoKeySecurity.cs
- CalendarDay.cs
- FileLoadException.cs
- ValueSerializer.cs
- DuplicateDetector.cs
- NumericExpr.cs
- MouseGestureValueSerializer.cs
- QueryGenerator.cs
- ImageListUtils.cs
- OperandQuery.cs
- SmtpException.cs
- AssemblyNameProxy.cs
- MergablePropertyAttribute.cs
- Variable.cs
- MouseGesture.cs
- FamilyMapCollection.cs
- BamlLocalizer.cs
- StylusSystemGestureEventArgs.cs
- SafeLocalMemHandle.cs
- MdiWindowListStrip.cs
- DataGridParentRows.cs
- Tuple.cs
- XmlILConstructAnalyzer.cs
- Error.cs
- RadioButtonList.cs
- CodeArrayCreateExpression.cs
- DataGridBoolColumn.cs
- DbConnectionStringBuilder.cs
- CodeTypeParameterCollection.cs
- RtType.cs
- TextDecoration.cs
- MemberInfoSerializationHolder.cs
- RecordBuilder.cs
- WebRequestModuleElement.cs
- ImageBrush.cs
- InvalidFilterCriteriaException.cs
- DbProviderFactories.cs