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
- AssociatedControlConverter.cs
- OdbcConnectionStringbuilder.cs
- Int16KeyFrameCollection.cs
- Command.cs
- CopyAttributesAction.cs
- DataGridViewUtilities.cs
- ClientSettingsStore.cs
- complextypematerializer.cs
- WindowsComboBox.cs
- QualifiedCellIdBoolean.cs
- WorkflowPageSetupDialog.cs
- CLSCompliantAttribute.cs
- XmlStringTable.cs
- TableHeaderCell.cs
- HandlerBase.cs
- PixelFormat.cs
- TripleDES.cs
- PersonalizationEntry.cs
- ListViewAutomationPeer.cs
- HasCopySemanticsAttribute.cs
- CurrentChangingEventManager.cs
- SelectingProviderEventArgs.cs
- HashHelper.cs
- objectquery_tresulttype.cs
- UnsafeNativeMethodsPenimc.cs
- ConstraintEnumerator.cs
- TextEditor.cs
- RectangleF.cs
- SuppressMessageAttribute.cs
- DataKey.cs
- DocumentCollection.cs
- FormatConvertedBitmap.cs
- Rotation3DAnimationBase.cs
- InternalDuplexBindingElement.cs
- StandardTransformFactory.cs
- StringBuilder.cs
- ProfilePropertySettingsCollection.cs
- CombinedTcpChannel.cs
- ViewDesigner.cs
- NavigatorInput.cs
- SchemaImporterExtensionElementCollection.cs
- ExpandoObject.cs
- WindowsGraphicsCacheManager.cs
- FrameworkContentElementAutomationPeer.cs
- DataServices.cs
- WebBrowser.cs
- TypeUtil.cs
- COM2ComponentEditor.cs
- BasicExpressionVisitor.cs
- PersonalizableAttribute.cs
- Activity.cs
- CfgParser.cs
- SymbolDocumentInfo.cs
- XmlEntity.cs
- XamlDesignerSerializationManager.cs
- WinFormsSecurity.cs
- TextBox.cs
- ProgressBarRenderer.cs
- EngineSiteSapi.cs
- PersonalizablePropertyEntry.cs
- StreamReader.cs
- BaseCollection.cs
- AudioFormatConverter.cs
- EntityClientCacheEntry.cs
- RangeValuePattern.cs
- SizeConverter.cs
- DecimalAnimationBase.cs
- HttpCacheVary.cs
- Column.cs
- MarkupObject.cs
- Catch.cs
- RuleSettings.cs
- RepeaterItemEventArgs.cs
- ChineseLunisolarCalendar.cs
- SqlInternalConnectionSmi.cs
- DataRowChangeEvent.cs
- categoryentry.cs
- MsmqHostedTransportConfiguration.cs
- BrowserDefinition.cs
- RemoteWebConfigurationHostServer.cs
- InputProviderSite.cs
- BufferedGraphics.cs
- ToolStripDropDownButton.cs
- InfoCardRequestException.cs
- ScaleTransform3D.cs
- XmlAttributeAttribute.cs
- GPStream.cs
- DiagnosticEventProvider.cs
- PersistChildrenAttribute.cs
- FormatterServices.cs
- __FastResourceComparer.cs
- PackageRelationshipCollection.cs
- RealProxy.cs
- RootBrowserWindowProxy.cs
- ellipse.cs
- StringValidator.cs
- ListViewCommandEventArgs.cs
- TreeViewImageIndexConverter.cs
- SecurityPolicySection.cs
- SqlCharStream.cs