Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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. // // ==--== // // 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ExceptionHandlerDesigner.cs
- ParameterInfo.cs
- _NegotiateClient.cs
- InputReport.cs
- TimelineGroup.cs
- InfoCardRequestException.cs
- Mutex.cs
- DiscreteKeyFrames.cs
- ActiveXContainer.cs
- AnnotationResourceCollection.cs
- ButtonField.cs
- FixedTextSelectionProcessor.cs
- ServiceObjectContainer.cs
- Substitution.cs
- ConnectionStringsExpressionBuilder.cs
- MissingMemberException.cs
- DBDataPermissionAttribute.cs
- SecurityTokenTypes.cs
- WinFormsComponentEditor.cs
- ResourceIDHelper.cs
- SignedXml.cs
- XPathArrayIterator.cs
- DeclaredTypeValidatorAttribute.cs
- XamlRtfConverter.cs
- DoubleKeyFrameCollection.cs
- ObjectItemCollection.cs
- AddInAdapter.cs
- DataGridViewRowStateChangedEventArgs.cs
- SignedXml.cs
- EntityProviderFactory.cs
- CheckBoxAutomationPeer.cs
- FrameworkTemplate.cs
- EventSetter.cs
- ToolStripCollectionEditor.cs
- XmlILOptimizerVisitor.cs
- SynchronizedMessageSource.cs
- XPathNodePointer.cs
- DataGridDesigner.cs
- InstancePersistence.cs
- RectKeyFrameCollection.cs
- Stopwatch.cs
- StickyNote.cs
- GCHandleCookieTable.cs
- InternalConfirm.cs
- TabletDevice.cs
- SQLInt16Storage.cs
- X509AsymmetricSecurityKey.cs
- ConvertBinder.cs
- ObjectDataSourceDisposingEventArgs.cs
- QuadTree.cs
- SqlInternalConnectionSmi.cs
- FontUnit.cs
- HtmlUtf8RawTextWriter.cs
- FontInfo.cs
- Compiler.cs
- ContractComponent.cs
- PasswordValidationException.cs
- GridViewRowPresenter.cs
- Assembly.cs
- SQLResource.cs
- Header.cs
- SqlComparer.cs
- ApplicationFileParser.cs
- TreeViewTemplateSelector.cs
- ImageClickEventArgs.cs
- AudioBase.cs
- MachineKeyConverter.cs
- AtomServiceDocumentSerializer.cs
- GridItemProviderWrapper.cs
- ToolStripScrollButton.cs
- EntitySqlQueryBuilder.cs
- TableRowGroup.cs
- ClaimComparer.cs
- SingleStorage.cs
- DesigntimeLicenseContext.cs
- EntityDataSourceQueryBuilder.cs
- ItemPager.cs
- ServiceChannelFactory.cs
- ThreadBehavior.cs
- Comparer.cs
- DataAccessor.cs
- XmlReflectionMember.cs
- EditingMode.cs
- KerberosReceiverSecurityToken.cs
- TextBoxBase.cs
- HighlightVisual.cs
- FunctionDescription.cs
- OdbcPermission.cs
- Ipv6Element.cs
- ComplexLine.cs
- DataContractSet.cs
- ThemeDirectoryCompiler.cs
- TabRenderer.cs
- CodeExpressionCollection.cs
- x509store.cs
- XmlUrlEditor.cs
- PropertyGridEditorPart.cs
- QueryCursorEventArgs.cs
- PropertyToken.cs
- Site.cs