Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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"; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AutomationPatternInfo.cs
- KeyValueConfigurationCollection.cs
- GridViewUpdatedEventArgs.cs
- SqlInternalConnectionSmi.cs
- BoundField.cs
- MethodInfo.cs
- CapabilitiesRule.cs
- FontDialog.cs
- RuntimeArgument.cs
- RequestQueue.cs
- Size.cs
- ConsoleTraceListener.cs
- ToolboxItemAttribute.cs
- RelationshipEntry.cs
- ParentControlDesigner.cs
- TableLayoutPanelResizeGlyph.cs
- ApplicationSecurityManager.cs
- XamlToRtfWriter.cs
- ITreeGenerator.cs
- BufferBuilder.cs
- CodeTypeDeclarationCollection.cs
- IdentifierCollection.cs
- ParseChildrenAsPropertiesAttribute.cs
- EventSourceCreationData.cs
- ImpersonationContext.cs
- SerializerProvider.cs
- RoleGroup.cs
- Rectangle.cs
- ToolStripActionList.cs
- HTMLTagNameToTypeMapper.cs
- GeometryCombineModeValidation.cs
- ListViewEditEventArgs.cs
- CommentEmitter.cs
- DesignerAttribute.cs
- UnsafeNativeMethods.cs
- GridViewCancelEditEventArgs.cs
- GridErrorDlg.cs
- ClientSponsor.cs
- _Events.cs
- OpacityConverter.cs
- SrgsRuleRef.cs
- WebUtil.cs
- COM2ExtendedTypeConverter.cs
- FormsAuthenticationConfiguration.cs
- JumpItem.cs
- TypeUsage.cs
- ImpersonationOption.cs
- SharedStream.cs
- SmiRecordBuffer.cs
- AuthStoreRoleProvider.cs
- TargetFrameworkUtil.cs
- EntityAdapter.cs
- DataGridViewImageColumn.cs
- UIPermission.cs
- CodeDomLoader.cs
- Size3D.cs
- UrlParameterReader.cs
- followingsibling.cs
- DataGridViewControlCollection.cs
- ExpressionEditorAttribute.cs
- InheritanceContextChangedEventManager.cs
- WindowsFormsHelpers.cs
- RequestStatusBarUpdateEventArgs.cs
- XmlLangPropertyAttribute.cs
- Section.cs
- EntityCommandCompilationException.cs
- pingexception.cs
- MetafileHeader.cs
- ResourcesGenerator.cs
- _NtlmClient.cs
- NetSectionGroup.cs
- SwitchAttribute.cs
- TreeViewDesigner.cs
- WebScriptClientGenerator.cs
- CalloutQueueItem.cs
- HtmlHead.cs
- CustomTypeDescriptor.cs
- QuestionEventArgs.cs
- AtomMaterializerLog.cs
- WeakReadOnlyCollection.cs
- PreloadedPackages.cs
- DesignerToolboxInfo.cs
- MergePropertyDescriptor.cs
- DataGridViewSelectedCellCollection.cs
- _NegotiateClient.cs
- RepeaterItemEventArgs.cs
- XPathNodePointer.cs
- WizardPanel.cs
- DuplexClientBase.cs
- OleDbRowUpdatingEvent.cs
- DisposableCollectionWrapper.cs
- TagPrefixAttribute.cs
- Cursor.cs
- ObjectHandle.cs
- CreateUserWizardAutoFormat.cs
- SystemPens.cs
- ContextMenuService.cs
- PageParser.cs
- DataGridClipboardHelper.cs
- LostFocusEventManager.cs