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
- SecurityTokenSerializer.cs
- FlagsAttribute.cs
- Parser.cs
- EventlogProvider.cs
- TableLayoutCellPaintEventArgs.cs
- SpellCheck.cs
- SerializerProvider.cs
- FontInfo.cs
- ThemeableAttribute.cs
- ResXBuildProvider.cs
- SecurityManager.cs
- WindowsScroll.cs
- UnauthorizedAccessException.cs
- ResourcesBuildProvider.cs
- XmlSchemaCompilationSettings.cs
- XmlSchemaException.cs
- CompoundFileReference.cs
- TcpAppDomainProtocolHandler.cs
- AccessedThroughPropertyAttribute.cs
- SqlGatherProducedAliases.cs
- BindingBase.cs
- DataListItemCollection.cs
- CleanUpVirtualizedItemEventArgs.cs
- ThicknessKeyFrameCollection.cs
- DependencyPropertyChangedEventArgs.cs
- SignatureConfirmationElement.cs
- XDeferredAxisSource.cs
- TableRow.cs
- MembershipPasswordException.cs
- MsmqQueue.cs
- AddDataControlFieldDialog.cs
- SequentialUshortCollection.cs
- FloaterParaClient.cs
- DbParameterCollectionHelper.cs
- ListViewItem.cs
- DataServiceHostFactory.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- ManagedWndProcTracker.cs
- PropagatorResult.cs
- securitycriticaldataClass.cs
- XmlSiteMapProvider.cs
- HttpRuntimeSection.cs
- SmiTypedGetterSetter.cs
- DataGridViewCellFormattingEventArgs.cs
- AddInContractAttribute.cs
- ToolStripContentPanel.cs
- NumberSubstitution.cs
- ObjectItemLoadingSessionData.cs
- DataPagerCommandEventArgs.cs
- BrushMappingModeValidation.cs
- HostedHttpRequestAsyncResult.cs
- EncoderParameter.cs
- UserNameSecurityTokenProvider.cs
- XmlReturnWriter.cs
- wgx_sdk_version.cs
- BinaryFormatterWriter.cs
- DataException.cs
- PriorityBindingExpression.cs
- DataGridViewColumnCollection.cs
- PropertyItem.cs
- XmlProcessingInstruction.cs
- IncrementalHitTester.cs
- UntrustedRecipientException.cs
- ColumnProvider.cs
- WindowsNonControl.cs
- Msmq.cs
- TextParaClient.cs
- HTTPNotFoundHandler.cs
- EventLogTraceListener.cs
- ModelFunction.cs
- DelegateHelpers.cs
- ParallelQuery.cs
- StringConverter.cs
- CompoundFileStreamReference.cs
- Transform.cs
- SqlProviderManifest.cs
- SafeUserTokenHandle.cs
- ComboBoxAutomationPeer.cs
- ToolStripPanelRenderEventArgs.cs
- Pair.cs
- TextTreeUndoUnit.cs
- ActivityContext.cs
- Root.cs
- ListParaClient.cs
- DesignerActionUI.cs
- BaseAddressElementCollection.cs
- TemplateBamlRecordReader.cs
- RIPEMD160.cs
- SecurityTokenTypes.cs
- SerialPort.cs
- Line.cs
- Label.cs
- SByteStorage.cs
- AttributeCollection.cs
- SerializationInfoEnumerator.cs
- RemotingException.cs
- SoapAttributes.cs
- CollectionExtensions.cs
- MetadataSerializer.cs
- Delegate.cs