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
- DependencyObjectType.cs
- PrtCap_Public_Simple.cs
- OleDbConnectionFactory.cs
- Mapping.cs
- NetSectionGroup.cs
- DispatcherHookEventArgs.cs
- OleDbParameterCollection.cs
- ObjectDataSourceView.cs
- FormattedText.cs
- OutOfMemoryException.cs
- CssTextWriter.cs
- WebServiceHandler.cs
- PtsPage.cs
- TreePrinter.cs
- PrintDialogException.cs
- HandleExceptionArgs.cs
- ProvidePropertyAttribute.cs
- CustomValidator.cs
- LocalServiceSecuritySettingsElement.cs
- SQLDateTimeStorage.cs
- FactoryId.cs
- ScrollBarRenderer.cs
- CallContext.cs
- ProcessThread.cs
- PriorityQueue.cs
- Transform.cs
- SHA1CryptoServiceProvider.cs
- FileStream.cs
- PublisherIdentityPermission.cs
- CapabilitiesSection.cs
- WindowsSolidBrush.cs
- Int32Rect.cs
- PerfCounterSection.cs
- UnknownWrapper.cs
- NestPullup.cs
- CurrencyWrapper.cs
- FrameworkRichTextComposition.cs
- BlurEffect.cs
- SqlError.cs
- DataColumnSelectionConverter.cs
- Events.cs
- IssuedTokenClientBehaviorsElement.cs
- GreenMethods.cs
- CacheSection.cs
- _HTTPDateParse.cs
- SettingsPropertyValueCollection.cs
- IUnknownConstantAttribute.cs
- FacetValues.cs
- BindingExpressionBase.cs
- TimerElapsedEvenArgs.cs
- XmlSerializerAssemblyAttribute.cs
- Base64WriteStateInfo.cs
- StringTraceRecord.cs
- RolePrincipal.cs
- TableAdapterManagerMethodGenerator.cs
- PropertyEntry.cs
- SortAction.cs
- DrawingVisualDrawingContext.cs
- SqlStatistics.cs
- PropertyCollection.cs
- PluralizationService.cs
- MatrixConverter.cs
- Int16AnimationUsingKeyFrames.cs
- XmlValueConverter.cs
- HttpContext.cs
- FilteredReadOnlyMetadataCollection.cs
- GetPageCompletedEventArgs.cs
- SettingsProviderCollection.cs
- FeatureSupport.cs
- IsolationInterop.cs
- SmtpReplyReaderFactory.cs
- StateMachineWorkflowInstance.cs
- DynamicValueConverter.cs
- ConditionalAttribute.cs
- SymDocumentType.cs
- ChineseLunisolarCalendar.cs
- HideDisabledControlAdapter.cs
- IntSecurity.cs
- FunctionParameter.cs
- SafeNativeMethodsCLR.cs
- TcpClientChannel.cs
- InkCanvasFeedbackAdorner.cs
- PeerConnector.cs
- HttpStaticObjectsCollectionWrapper.cs
- TableLayoutSettingsTypeConverter.cs
- DetailsViewPageEventArgs.cs
- BaseCodeDomTreeGenerator.cs
- ValueExpressions.cs
- FontDifferentiator.cs
- PointCollectionConverter.cs
- HttpListenerRequest.cs
- TimestampInformation.cs
- EncoderReplacementFallback.cs
- MgmtResManager.cs
- PackageDocument.cs
- PolicyValidationException.cs
- Scene3D.cs
- GuidelineSet.cs
- DesignColumn.cs
- PreviewPageInfo.cs