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
- ImageCodecInfoPrivate.cs
- HtmlToClrEventProxy.cs
- ComboBoxItem.cs
- TimeoutException.cs
- RequestCacheValidator.cs
- StyleReferenceConverter.cs
- TreeNodeBinding.cs
- PeerNodeTraceRecord.cs
- DataGridViewMethods.cs
- BaseResourcesBuildProvider.cs
- ExpressionLexer.cs
- TdsParserSafeHandles.cs
- SchemaImporterExtension.cs
- DesignerActionHeaderItem.cs
- RSAPKCS1KeyExchangeFormatter.cs
- Binding.cs
- PeekCompletedEventArgs.cs
- HtmlImage.cs
- ZipIOBlockManager.cs
- DesignBindingPicker.cs
- UnaryExpression.cs
- XmlSchemaComplexType.cs
- MgmtResManager.cs
- Types.cs
- TimeIntervalCollection.cs
- AttributeSetAction.cs
- SingleObjectCollection.cs
- FormView.cs
- SynchronizedDispatch.cs
- WizardStepBase.cs
- SaveFileDialog.cs
- GenerateScriptTypeAttribute.cs
- XhtmlTextWriter.cs
- InputBinder.cs
- MetadataFile.cs
- ReliableMessagingVersionConverter.cs
- AssociativeAggregationOperator.cs
- SimpleWebHandlerParser.cs
- SyndicationPerson.cs
- EdmToObjectNamespaceMap.cs
- ListBox.cs
- InsufficientMemoryException.cs
- CLRBindingWorker.cs
- parserscommon.cs
- DoubleCollectionValueSerializer.cs
- XmlWrappingReader.cs
- FormsAuthenticationCredentials.cs
- HtmlShim.cs
- ConfigXmlSignificantWhitespace.cs
- MediaElement.cs
- StyleModeStack.cs
- SerializableReadOnlyDictionary.cs
- Exception.cs
- PenCursorManager.cs
- Thumb.cs
- SQLGuid.cs
- PathFigure.cs
- StructuredTypeEmitter.cs
- PropertyChangeTracker.cs
- XmlDocumentSerializer.cs
- DataTableCollection.cs
- GridViewCommandEventArgs.cs
- WebPartConnectionsCancelEventArgs.cs
- GrammarBuilder.cs
- XmlSchemaType.cs
- XPathException.cs
- DesignerDataStoredProcedure.cs
- UTF32Encoding.cs
- InlinedAggregationOperatorEnumerator.cs
- DataChangedEventManager.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- NullPackagingPolicy.cs
- FormsIdentity.cs
- IsolatedStoragePermission.cs
- BulletDecorator.cs
- TrackPointCollection.cs
- DataError.cs
- XmlChoiceIdentifierAttribute.cs
- ClientBuildManagerCallback.cs
- OverlappedAsyncResult.cs
- TypeSemantics.cs
- SystemUdpStatistics.cs
- DataGridHeadersVisibilityToVisibilityConverter.cs
- BamlMapTable.cs
- SoapCommonClasses.cs
- ListViewItemSelectionChangedEvent.cs
- RemotingConfigParser.cs
- EventlogProvider.cs
- XPathScanner.cs
- ScrollPatternIdentifiers.cs
- RenderData.cs
- WebPartDescription.cs
- ScrollBarRenderer.cs
- _NestedSingleAsyncResult.cs
- PeerChannelListener.cs
- SimpleType.cs
- DllNotFoundException.cs
- SamlAuthorizationDecisionClaimResource.cs
- DatePickerDateValidationErrorEventArgs.cs
- ConfigurationStrings.cs