Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / System / Security / Cryptography / SignatureDescription.cs / 1 / SignatureDescription.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // SignatureDescription.cs // namespace System.Security.Cryptography { using System.Security.Util; [System.Runtime.InteropServices.ComVisible(true)] public class SignatureDescription { private String _strKey; private String _strDigest; private String _strFormatter; private String _strDeformatter; // // public constructors // public SignatureDescription() { } public SignatureDescription(SecurityElement el) { if (el == null) throw new ArgumentNullException("el"); _strKey = el.SearchForTextOfTag("Key"); _strDigest = el.SearchForTextOfTag("Digest"); _strFormatter = el.SearchForTextOfTag("Formatter"); _strDeformatter = el.SearchForTextOfTag("Deformatter"); } // // property methods // public String KeyAlgorithm { get { return _strKey; } set { _strKey = value; } } public String DigestAlgorithm { get { return _strDigest; } set { _strDigest = value; } } public String FormatterAlgorithm { get { return _strFormatter; } set { _strFormatter = value; } } public String DeformatterAlgorithm { get {return _strDeformatter; } set {_strDeformatter = value; } } // // public methods // public virtual AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key) { AsymmetricSignatureDeformatter item; item = (AsymmetricSignatureDeformatter) CryptoConfig.CreateFromName(_strDeformatter); item.SetKey(key); return item; } public virtual AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key) { AsymmetricSignatureFormatter item; item = (AsymmetricSignatureFormatter) CryptoConfig.CreateFromName(_strFormatter); item.SetKey(key); return item; } public virtual HashAlgorithm CreateDigest() { return (HashAlgorithm) CryptoConfig.CreateFromName(_strDigest); } } internal class RSAPKCS1SHA1SignatureDescription : SignatureDescription { public RSAPKCS1SHA1SignatureDescription() { KeyAlgorithm = "System.Security.Cryptography.RSACryptoServiceProvider"; DigestAlgorithm = "System.Security.Cryptography.SHA1CryptoServiceProvider"; FormatterAlgorithm = "System.Security.Cryptography.RSAPKCS1SignatureFormatter"; DeformatterAlgorithm = "System.Security.Cryptography.RSAPKCS1SignatureDeformatter"; } public override AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key) { AsymmetricSignatureDeformatter item = (AsymmetricSignatureDeformatter) CryptoConfig.CreateFromName(DeformatterAlgorithm); item.SetKey(key); item.SetHashAlgorithm("SHA1"); return item; } } internal class DSASignatureDescription : SignatureDescription { public DSASignatureDescription() { KeyAlgorithm = "System.Security.Cryptography.DSACryptoServiceProvider"; DigestAlgorithm = "System.Security.Cryptography.SHA1CryptoServiceProvider"; FormatterAlgorithm = "System.Security.Cryptography.DSASignatureFormatter"; DeformatterAlgorithm = "System.Security.Cryptography.DSASignatureDeformatter"; } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WSDualHttpBinding.cs
- XsdSchemaFileEditor.cs
- recordstatefactory.cs
- PersonalizationStateInfoCollection.cs
- DockingAttribute.cs
- SchemaTableOptionalColumn.cs
- TextMarkerSource.cs
- SQLConvert.cs
- _FixedSizeReader.cs
- Style.cs
- UnmanagedBitmapWrapper.cs
- NamespaceCollection.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- FrameworkElement.cs
- ImageBrush.cs
- ExpressionHelper.cs
- TextEditorDragDrop.cs
- ResourceSetExpression.cs
- NativeMethods.cs
- SystemInfo.cs
- XsdDataContractImporter.cs
- InlinedAggregationOperatorEnumerator.cs
- DbConnectionStringCommon.cs
- DispatcherSynchronizationContext.cs
- FixedFindEngine.cs
- CounterSetInstanceCounterDataSet.cs
- ToolStripInSituService.cs
- IconHelper.cs
- ZipIOBlockManager.cs
- VisualStyleInformation.cs
- HostingEnvironmentSection.cs
- DetailsViewPageEventArgs.cs
- OleCmdHelper.cs
- MediaSystem.cs
- InfoCardServiceInstallComponent.cs
- NamespaceEmitter.cs
- ContainerSelectorActiveEvent.cs
- XAMLParseException.cs
- TableStyle.cs
- Utility.cs
- BamlReader.cs
- CollectionView.cs
- RepeaterItemEventArgs.cs
- MessageQueueException.cs
- PeerUnsafeNativeMethods.cs
- GroupStyle.cs
- HttpRequest.cs
- ContentType.cs
- ChannelServices.cs
- KeyedQueue.cs
- NotImplementedException.cs
- DataKeyArray.cs
- FileDataSourceCache.cs
- GPStream.cs
- CompositeControl.cs
- SystemEvents.cs
- DatagramAdapter.cs
- RequestUriProcessor.cs
- ScrollPattern.cs
- ClientSession.cs
- ParallelTimeline.cs
- CustomError.cs
- XmlComment.cs
- DataBindingCollection.cs
- AtomMaterializer.cs
- EditBehavior.cs
- CharacterBuffer.cs
- EventDriven.cs
- UnsafeNativeMethods.cs
- TimelineCollection.cs
- FormCollection.cs
- CallContext.cs
- EntityDataSourceContextCreatingEventArgs.cs
- Dump.cs
- TabOrder.cs
- TextBoxAutomationPeer.cs
- XmlSerializerSection.cs
- GeometryValueSerializer.cs
- StopRoutingHandler.cs
- GeneralTransform2DTo3D.cs
- DataGridViewCellPaintingEventArgs.cs
- TypeExtensions.cs
- BlurEffect.cs
- RegistryKey.cs
- DataSourceXmlTextReader.cs
- FileLogRecordEnumerator.cs
- DataBindingValueUIHandler.cs
- _FtpControlStream.cs
- CompiledXpathExpr.cs
- SmiEventSink_Default.cs
- WebPartCloseVerb.cs
- followingsibling.cs
- ClockController.cs
- TextEffectCollection.cs
- KeyboardEventArgs.cs
- ObjectIDGenerator.cs
- HebrewCalendar.cs
- UniqueIdentifierService.cs
- StateItem.cs
- EntityClassGenerator.cs