Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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"; } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TcpAppDomainProtocolHandler.cs
- WebPartEditorOkVerb.cs
- ResourceContainerWrapper.cs
- SharedConnectionWorkflowTransactionService.cs
- HorizontalAlignConverter.cs
- XmlDomTextWriter.cs
- StringResourceManager.cs
- SmtpClient.cs
- OleDbStruct.cs
- CommentGlyph.cs
- SqlComparer.cs
- ListViewItem.cs
- WebHttpSecurity.cs
- ParserContext.cs
- StringOutput.cs
- LocatorPartList.cs
- AsynchronousChannel.cs
- CollectionType.cs
- TraceHwndHost.cs
- Coordinator.cs
- ChtmlTextWriter.cs
- GuidConverter.cs
- MetadataCache.cs
- ContentDisposition.cs
- DictionarySurrogate.cs
- LinqDataSourceStatusEventArgs.cs
- AtlasWeb.Designer.cs
- RichTextBoxConstants.cs
- ValidationErrorInfo.cs
- StylusButton.cs
- ChannelServices.cs
- WorkflowTimerService.cs
- PerformanceCounterManager.cs
- SmtpSection.cs
- ConditionalWeakTable.cs
- SecureStringHasher.cs
- CharacterMetricsDictionary.cs
- SafeBitVector32.cs
- SubMenuStyle.cs
- Util.cs
- wgx_commands.cs
- ComponentEditorPage.cs
- CreateUserErrorEventArgs.cs
- ObfuscateAssemblyAttribute.cs
- FunctionUpdateCommand.cs
- Graphics.cs
- DataBindingHandlerAttribute.cs
- Matrix3D.cs
- DetailsView.cs
- FtpWebResponse.cs
- TypeConvertions.cs
- IProvider.cs
- ErrorTolerantObjectWriter.cs
- XPathParser.cs
- XPathScanner.cs
- SelectManyQueryOperator.cs
- DesignerProperties.cs
- TypeGeneratedEventArgs.cs
- SingleBodyParameterMessageFormatter.cs
- XmlJsonWriter.cs
- SortExpressionBuilder.cs
- TablePattern.cs
- KeyNotFoundException.cs
- _LoggingObject.cs
- WindowsToolbarAsMenu.cs
- TrackingCondition.cs
- XmlSchemaType.cs
- DataSourceXmlElementAttribute.cs
- ActivationArguments.cs
- NegotiateStream.cs
- ProtectedConfigurationSection.cs
- TableSectionStyle.cs
- ParameterToken.cs
- StrongName.cs
- MatrixAnimationUsingKeyFrames.cs
- ZipPackage.cs
- MatrixIndependentAnimationStorage.cs
- COM2ICategorizePropertiesHandler.cs
- DBConnectionString.cs
- DeferredReference.cs
- COAUTHIDENTITY.cs
- CurrentTimeZone.cs
- XmlAggregates.cs
- ProfileProvider.cs
- DecoderBestFitFallback.cs
- HtmlControlPersistable.cs
- HtmlInputReset.cs
- Models.cs
- AssemblyAttributes.cs
- XmlLoader.cs
- DataBindingExpressionBuilder.cs
- PeerTransportElement.cs
- WebPartDisplayMode.cs
- GridItemProviderWrapper.cs
- CharEnumerator.cs
- SoapHttpTransportImporter.cs
- Connector.xaml.cs
- CompilerTypeWithParams.cs
- UIAgentInitializationException.cs
- LayoutTable.cs