Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ListViewItemMouseHoverEvent.cs
- OdbcInfoMessageEvent.cs
- DataConnectionHelper.cs
- ToolBarButtonClickEvent.cs
- ResourceReferenceExpressionConverter.cs
- CodeComment.cs
- Variant.cs
- XmlNotation.cs
- MutableAssemblyCacheEntry.cs
- WriteTimeStream.cs
- WizardForm.cs
- GeometryGroup.cs
- AssociatedControlConverter.cs
- HuffCodec.cs
- MetadataItemEmitter.cs
- odbcmetadatafactory.cs
- GlyphRun.cs
- MessageQueuePermissionEntryCollection.cs
- ThreadStateException.cs
- WindowsSecurityToken.cs
- BitmapMetadataBlob.cs
- StringConcat.cs
- OptimizerPatterns.cs
- ValidationVisibilityAttribute.cs
- HMACSHA384.cs
- ImpersonateTokenRef.cs
- QueryPageSettingsEventArgs.cs
- TextFragmentEngine.cs
- MaskPropertyEditor.cs
- DrawingImage.cs
- HttpListenerElement.cs
- BamlTreeMap.cs
- XmlnsDefinitionAttribute.cs
- ColorAnimationBase.cs
- XMLSchema.cs
- Line.cs
- ToolStripHighContrastRenderer.cs
- Int32RectValueSerializer.cs
- StreamWithDictionary.cs
- ScrollableControl.cs
- RequestDescription.cs
- WindowsListViewScroll.cs
- HashMembershipCondition.cs
- EndpointDiscoveryMetadata.cs
- Int32Converter.cs
- Misc.cs
- __Filters.cs
- ComPlusTypeLoader.cs
- ButtonPopupAdapter.cs
- FormsAuthenticationUser.cs
- Stylesheet.cs
- AuthStoreRoleProvider.cs
- SQLRoleProvider.cs
- TailCallAnalyzer.cs
- QuaternionRotation3D.cs
- DataBoundControlAdapter.cs
- VariantWrapper.cs
- Tile.cs
- ContainerParagraph.cs
- UIntPtr.cs
- ShaderEffect.cs
- TypeInitializationException.cs
- SocketCache.cs
- ConstructorNeedsTagAttribute.cs
- Schedule.cs
- CultureInfo.cs
- HiddenFieldPageStatePersister.cs
- ADMembershipUser.cs
- AssemblyHash.cs
- ErrorLog.cs
- TransferRequestHandler.cs
- IPeerNeighbor.cs
- DataGridPagerStyle.cs
- HuffCodec.cs
- SettingsPropertyValueCollection.cs
- MSAAEventDispatcher.cs
- ConnectionStringsExpressionEditor.cs
- CompiledQuery.cs
- AutomationElementIdentifiers.cs
- unsafenativemethodstextservices.cs
- CancellationHandler.cs
- WindowsIPAddress.cs
- InvalidCommandTreeException.cs
- ImageDrawing.cs
- TextEditorParagraphs.cs
- WindowsIPAddress.cs
- DbBuffer.cs
- DocumentViewerConstants.cs
- DataSourceControl.cs
- EdmItemCollection.cs
- HtmlInputSubmit.cs
- ToolStripButton.cs
- XmlSchemaSubstitutionGroup.cs
- VerificationException.cs
- _emptywebproxy.cs
- WebPartEventArgs.cs
- XPathExpr.cs
- FastPropertyAccessor.cs
- SortAction.cs
- OutArgumentConverter.cs