Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- MasterPageParser.cs
- Fault.cs
- ReadWriteObjectLock.cs
- ProcessMessagesAsyncResult.cs
- Enum.cs
- CloudCollection.cs
- DesignTimeParseData.cs
- WebPartConnectionsCancelVerb.cs
- UnitySerializationHolder.cs
- securitycriticaldataformultiplegetandset.cs
- EncodingTable.cs
- AnnotationResourceChangedEventArgs.cs
- XmlEncoding.cs
- Expressions.cs
- Documentation.cs
- PaginationProgressEventArgs.cs
- List.cs
- WpfWebRequestHelper.cs
- SecurityKeyUsage.cs
- EntityDesignerBuildProvider.cs
- InputBindingCollection.cs
- ipaddressinformationcollection.cs
- WindowsFormsHostPropertyMap.cs
- Native.cs
- CustomAttributeSerializer.cs
- DataListCommandEventArgs.cs
- SettingsProviderCollection.cs
- CompilationSection.cs
- InputReferenceExpression.cs
- GetCardDetailsRequest.cs
- XmlTextAttribute.cs
- TypeLoadException.cs
- AsymmetricAlgorithm.cs
- AsymmetricKeyExchangeFormatter.cs
- RegexMatchCollection.cs
- Error.cs
- OdbcError.cs
- EdmPropertyAttribute.cs
- VersionPair.cs
- Line.cs
- VirtualPath.cs
- GeneralTransform3DTo2DTo3D.cs
- GeneralTransform.cs
- CharAnimationBase.cs
- SmiMetaDataProperty.cs
- CommandField.cs
- AccessDataSourceView.cs
- ConditionalAttribute.cs
- RelationshipManager.cs
- Rect3D.cs
- NamespaceCollection.cs
- ServiceHttpModule.cs
- BamlRecordWriter.cs
- ExpressionNormalizer.cs
- ImageSourceConverter.cs
- KerberosRequestorSecurityToken.cs
- GridView.cs
- WinInetCache.cs
- EnumBuilder.cs
- XmlC14NWriter.cs
- UserControlParser.cs
- TemplatePartAttribute.cs
- PreProcessInputEventArgs.cs
- SEHException.cs
- Int16Converter.cs
- DataSourceHelper.cs
- XmlNamespaceMappingCollection.cs
- RoutedEventConverter.cs
- OperatingSystemVersionCheck.cs
- DetailsViewUpdateEventArgs.cs
- ListViewTableCell.cs
- FtpCachePolicyElement.cs
- CodeDOMUtility.cs
- DateRangeEvent.cs
- DataGridViewRowStateChangedEventArgs.cs
- TableLayoutSettings.cs
- SoapReflector.cs
- DesignerHierarchicalDataSourceView.cs
- WindowsIdentity.cs
- RealizedColumnsBlock.cs
- DesignerHost.cs
- ObjectStorage.cs
- XmlSchemaFacet.cs
- MainMenu.cs
- Delegate.cs
- ComponentManagerBroker.cs
- AssemblyUtil.cs
- Mappings.cs
- XmlDocumentType.cs
- UInt64Converter.cs
- Style.cs
- ComponentEditorPage.cs
- _Rfc2616CacheValidators.cs
- EntityClassGenerator.cs
- SHA384Managed.cs
- DesignColumn.cs
- Int32.cs
- Event.cs
- InternalConfigSettingsFactory.cs
- IPAddressCollection.cs