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
- FieldNameLookup.cs
- HtmlTableCellCollection.cs
- TimeSpanSecondsConverter.cs
- HostingEnvironmentSection.cs
- SafeProcessHandle.cs
- HelpEvent.cs
- TemplatedAdorner.cs
- ReceiveActivityDesigner.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- wgx_commands.cs
- ComPlusContractBehavior.cs
- XpsPackagingException.cs
- IndexExpression.cs
- FrameworkObject.cs
- TemplateBindingExpression.cs
- MemoryStream.cs
- CheckBoxPopupAdapter.cs
- Timer.cs
- MultiView.cs
- WhitespaceSignificantCollectionAttribute.cs
- WebBrowserBase.cs
- XmlSiteMapProvider.cs
- SizeIndependentAnimationStorage.cs
- RequestNavigateEventArgs.cs
- DeploymentSection.cs
- DatatypeImplementation.cs
- AddDataControlFieldDialog.cs
- BrowserDefinitionCollection.cs
- SmiEventSink_Default.cs
- XmlQueryTypeFactory.cs
- InvalidDataContractException.cs
- GlyphRunDrawing.cs
- StatusBarPanel.cs
- StorageConditionPropertyMapping.cs
- SqlConnection.cs
- StylusButton.cs
- WebPartTracker.cs
- MessageParameterAttribute.cs
- ThreadStartException.cs
- GifBitmapDecoder.cs
- WriteStateInfoBase.cs
- ContentPathSegment.cs
- WindowsSolidBrush.cs
- PrintPreviewDialog.cs
- HttpAsyncResult.cs
- FilteredReadOnlyMetadataCollection.cs
- PaintValueEventArgs.cs
- ListBindableAttribute.cs
- XmlSchemaSimpleTypeUnion.cs
- ResourcesBuildProvider.cs
- ProfileModule.cs
- HttpModuleActionCollection.cs
- GetRecipientListRequest.cs
- NamespaceInfo.cs
- EntityConnectionStringBuilder.cs
- coordinator.cs
- WebResourceUtil.cs
- AsymmetricSecurityProtocolFactory.cs
- SecUtil.cs
- FactoryId.cs
- WebBaseEventKeyComparer.cs
- HtmlSelect.cs
- DrawListViewColumnHeaderEventArgs.cs
- Wizard.cs
- Image.cs
- FactoryGenerator.cs
- DeferredReference.cs
- ShaderRenderModeValidation.cs
- DesignerActionVerbItem.cs
- MediaPlayer.cs
- VariantWrapper.cs
- SyntaxCheck.cs
- SpStreamWrapper.cs
- MetadataArtifactLoaderComposite.cs
- HwndSourceKeyboardInputSite.cs
- MultitargetUtil.cs
- TypeDescriptorFilterService.cs
- WsatAdminException.cs
- FormClosingEvent.cs
- HtmlListAdapter.cs
- TiffBitmapDecoder.cs
- OdbcUtils.cs
- RangeValuePattern.cs
- SettingsPropertyCollection.cs
- BaseDataBoundControl.cs
- IIS7WorkerRequest.cs
- MouseButton.cs
- ProtocolsConfiguration.cs
- ListViewDesigner.cs
- ResourcesChangeInfo.cs
- WebPartHeaderCloseVerb.cs
- TraceHandlerErrorFormatter.cs
- AutomationIdentifier.cs
- DynamicValueConverter.cs
- ObservableDictionary.cs
- ListBoxItemAutomationPeer.cs
- InputBinding.cs
- DataGridViewButtonCell.cs
- BaseInfoTable.cs
- WebEvents.cs