Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / Cryptography / SignatureDescription.cs / 1305376 / SignatureDescription.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== //[....] // // // SignatureDescription.cs // namespace System.Security.Cryptography { using System.Security.Util; using System.Diagnostics.Contracts; [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"); Contract.EndContractBlock(); _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 // [System.Security.SecuritySafeCritical] // auto-generated public virtual AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key) { AsymmetricSignatureDeformatter item; item = (AsymmetricSignatureDeformatter) CryptoConfig.CreateFromName(_strDeformatter); item.SetKey(key); return item; } [System.Security.SecuritySafeCritical] // auto-generated public virtual AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key) { AsymmetricSignatureFormatter item; item = (AsymmetricSignatureFormatter) CryptoConfig.CreateFromName(_strFormatter); item.SetKey(key); return item; } [System.Security.SecuritySafeCritical] // auto-generated 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; using System.Diagnostics.Contracts; [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"); Contract.EndContractBlock(); _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 // [System.Security.SecuritySafeCritical] // auto-generated public virtual AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key) { AsymmetricSignatureDeformatter item; item = (AsymmetricSignatureDeformatter) CryptoConfig.CreateFromName(_strDeformatter); item.SetKey(key); return item; } [System.Security.SecuritySafeCritical] // auto-generated public virtual AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key) { AsymmetricSignatureFormatter item; item = (AsymmetricSignatureFormatter) CryptoConfig.CreateFromName(_strFormatter); item.SetKey(key); return item; } [System.Security.SecuritySafeCritical] // auto-generated 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
- PerformanceCounterManager.cs
- SystemDiagnosticsSection.cs
- DataGridViewCheckBoxCell.cs
- DecoratedNameAttribute.cs
- SoapIgnoreAttribute.cs
- ProtocolsConfigurationEntry.cs
- StringToken.cs
- OrderPreservingPipeliningMergeHelper.cs
- RouteData.cs
- CollectionConverter.cs
- TrimSurroundingWhitespaceAttribute.cs
- RoutedCommand.cs
- FunctionUpdateCommand.cs
- SettingsPropertyWrongTypeException.cs
- HWStack.cs
- TreeBuilder.cs
- DefaultBinder.cs
- DeferredTextReference.cs
- KeyValuePair.cs
- SerialPort.cs
- ConditionalAttribute.cs
- ComponentSerializationService.cs
- ConstraintConverter.cs
- PrtTicket_Base.cs
- SizeChangedEventArgs.cs
- StatusBarAutomationPeer.cs
- CodeAttributeDeclaration.cs
- BitmapVisualManager.cs
- CommandValueSerializer.cs
- ToolStripContentPanel.cs
- IsolatedStorageFile.cs
- UnmanagedMarshal.cs
- XmlReflectionMember.cs
- SortExpressionBuilder.cs
- MenuScrollingVisibilityConverter.cs
- BackgroundWorker.cs
- MemoryStream.cs
- VerbConverter.cs
- ControlEvent.cs
- RowType.cs
- StorageAssociationSetMapping.cs
- Light.cs
- CodeAssignStatement.cs
- ArrayHelper.cs
- PagedDataSource.cs
- messageonlyhwndwrapper.cs
- HttpProfileGroupBase.cs
- VideoDrawing.cs
- LabelExpression.cs
- GPPOINTF.cs
- FieldDescriptor.cs
- PostBackTrigger.cs
- RemotingAttributes.cs
- SafeNativeMethods.cs
- CodeThrowExceptionStatement.cs
- TdsParserSessionPool.cs
- ObjectDataSourceStatusEventArgs.cs
- XmlSchemaType.cs
- MonitorWrapper.cs
- PresentationTraceSources.cs
- PropertySourceInfo.cs
- EnvironmentPermission.cs
- HyperLinkColumn.cs
- PolicyConversionContext.cs
- Font.cs
- HTMLTagNameToTypeMapper.cs
- ObjectTag.cs
- InputScopeConverter.cs
- RangeValuePattern.cs
- PageCache.cs
- EntitySet.cs
- XhtmlConformanceSection.cs
- CryptoKeySecurity.cs
- Internal.cs
- DisplayNameAttribute.cs
- OperatingSystem.cs
- KerberosSecurityTokenAuthenticator.cs
- ImageInfo.cs
- FontFamilyValueSerializer.cs
- CryptoApi.cs
- SortedList.cs
- OracleInternalConnection.cs
- UniqueIdentifierService.cs
- Int64KeyFrameCollection.cs
- RegistryConfigurationProvider.cs
- HostedTransportConfigurationManager.cs
- WebPartZoneBaseDesigner.cs
- CodeSnippetExpression.cs
- EdmConstants.cs
- BitmapEffectInput.cs
- InternalConfigRoot.cs
- OAVariantLib.cs
- Identity.cs
- BitmapEncoder.cs
- MexBindingBindingCollectionElement.cs
- ComAdminWrapper.cs
- RelationshipFixer.cs
- Configuration.cs
- SHA256Managed.cs
- SafeEventLogWriteHandle.cs