Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlKeywords.cs
- ViewBox.cs
- UidPropertyAttribute.cs
- Animatable.cs
- ProcessInfo.cs
- InstanceDataCollectionCollection.cs
- SqlUtil.cs
- Exceptions.cs
- CompatibleIComparer.cs
- DesignerDataConnection.cs
- Rect3D.cs
- _ConnectStream.cs
- NativeMethods.cs
- ProxyWebPartManager.cs
- SqlGatherConsumedAliases.cs
- CompilerLocalReference.cs
- SecUtil.cs
- HttpCapabilitiesBase.cs
- HebrewNumber.cs
- PocoEntityKeyStrategy.cs
- ResourcePermissionBaseEntry.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- StylusCollection.cs
- IntMinMaxAggregationOperator.cs
- Util.cs
- WeakReadOnlyCollection.cs
- QueueAccessMode.cs
- FixedHyperLink.cs
- Terminate.cs
- StrongNamePublicKeyBlob.cs
- VBCodeProvider.cs
- AdornerPresentationContext.cs
- ComponentDispatcherThread.cs
- documentsequencetextcontainer.cs
- PathFigure.cs
- ExtentCqlBlock.cs
- DataObjectPastingEventArgs.cs
- AspNetHostingPermission.cs
- ParseHttpDate.cs
- ChtmlTextWriter.cs
- WindowsTokenRoleProvider.cs
- LocalValueEnumerator.cs
- SchemaImporterExtensionElement.cs
- DefaultSerializationProviderAttribute.cs
- WorkItem.cs
- Point3DKeyFrameCollection.cs
- CodeGeneratorAttribute.cs
- MdiWindowListItemConverter.cs
- Automation.cs
- SqlCachedBuffer.cs
- XPathDocumentIterator.cs
- WebControlAdapter.cs
- NotifyCollectionChangedEventArgs.cs
- ExtendLockAsyncResult.cs
- MappingModelBuildProvider.cs
- EmptyQuery.cs
- MsmqTransportSecurityElement.cs
- ApplicationActivator.cs
- ComUdtElementCollection.cs
- TypeHelper.cs
- ManagementOperationWatcher.cs
- EntityDataSourceChangingEventArgs.cs
- ComponentCache.cs
- FixedPage.cs
- BookmarkScopeHandle.cs
- UserPersonalizationStateInfo.cs
- ISCIIEncoding.cs
- DrawingAttributesDefaultValueFactory.cs
- Array.cs
- XmlSerializableReader.cs
- ValidatorCompatibilityHelper.cs
- WindowsFormsSynchronizationContext.cs
- ProcessModelSection.cs
- XmlExtensionFunction.cs
- XhtmlBasicCommandAdapter.cs
- _SslStream.cs
- ColumnMapVisitor.cs
- PropertySourceInfo.cs
- SaveFileDialogDesigner.cs
- ZoomPercentageConverter.cs
- IdnElement.cs
- NotificationContext.cs
- DrawingBrush.cs
- StrokeNode.cs
- WebRequest.cs
- DeploymentSection.cs
- ResXResourceSet.cs
- WindowsToolbarItemAsMenuItem.cs
- DocumentReference.cs
- PropertyChangingEventArgs.cs
- GridViewColumnCollectionChangedEventArgs.cs
- HttpVersion.cs
- Boolean.cs
- DesignerDataParameter.cs
- SliderAutomationPeer.cs
- ChangeTracker.cs
- PerformanceCounterManager.cs
- MeshGeometry3D.cs
- HtmlControl.cs
- DataGridTableCollection.cs