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
- AsnEncodedData.cs
- ProxyElement.cs
- OdbcEnvironment.cs
- ObjectStorage.cs
- ComplexLine.cs
- DesignerSerializerAttribute.cs
- UriTemplateVariableQueryValue.cs
- SqlWriter.cs
- PipelineModuleStepContainer.cs
- DataSourceControl.cs
- MeshGeometry3D.cs
- SpellCheck.cs
- DataBindingHandlerAttribute.cs
- QueryableDataSource.cs
- BoundsDrawingContextWalker.cs
- UnsafeNativeMethods.cs
- FixedTextSelectionProcessor.cs
- SortedList.cs
- DbProviderFactories.cs
- DebuggerAttributes.cs
- MaterializeFromAtom.cs
- FeatureSupport.cs
- WarningException.cs
- DrawTreeNodeEventArgs.cs
- DiscoveryInnerClientAdhocCD1.cs
- FacetValues.cs
- MapPathBasedVirtualPathProvider.cs
- EraserBehavior.cs
- SystemGatewayIPAddressInformation.cs
- MemberInfoSerializationHolder.cs
- WrappedReader.cs
- TriggerActionCollection.cs
- HtmlProps.cs
- SharedStatics.cs
- TableLayoutPanelCellPosition.cs
- BrowserCapabilitiesCompiler.cs
- SubMenuStyle.cs
- ConditionCollection.cs
- MenuRenderer.cs
- SimpleTypeResolver.cs
- SkipQueryOptionExpression.cs
- DataBindingList.cs
- TableCell.cs
- DesignerVerbCollection.cs
- IconEditor.cs
- IntPtr.cs
- EnvironmentPermission.cs
- SchemaMapping.cs
- BuildProvider.cs
- TTSEngineProxy.cs
- CqlIdentifiers.cs
- WebServiceParameterData.cs
- Merger.cs
- ITextView.cs
- ListViewDataItem.cs
- CodeTypeDelegate.cs
- SafeFileHandle.cs
- SelectionItemPattern.cs
- FlowDocumentReaderAutomationPeer.cs
- Vertex.cs
- _Rfc2616CacheValidators.cs
- ScriptResourceInfo.cs
- GenericRootAutomationPeer.cs
- OneOfTypeConst.cs
- ProcessHostServerConfig.cs
- ApplyTemplatesAction.cs
- StringArrayConverter.cs
- SignatureDescription.cs
- NamespaceMapping.cs
- StructuralCache.cs
- DataGridViewCellParsingEventArgs.cs
- DetailsView.cs
- LogReservationCollection.cs
- NativeMethods.cs
- EntityClientCacheEntry.cs
- BufferedGraphicsManager.cs
- ParameterBinding.cs
- FileAuthorizationModule.cs
- DesignerSerializationOptionsAttribute.cs
- PersonalizationAdministration.cs
- CodeAttributeArgument.cs
- PenThreadWorker.cs
- PointAnimation.cs
- BufferModesCollection.cs
- TextElementEnumerator.cs
- CheckBox.cs
- CannotUnloadAppDomainException.cs
- ScriptMethodAttribute.cs
- WebPartEditorCancelVerb.cs
- BindingWorker.cs
- SystemTcpConnection.cs
- Brush.cs
- DataGridAddNewRow.cs
- Thread.cs
- Application.cs
- CommandEventArgs.cs
- PseudoWebRequest.cs
- OutputCacheProfileCollection.cs
- DBPropSet.cs
- ResXResourceSet.cs