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
- SimpleNameService.cs
- X509Chain.cs
- PathFigureCollection.cs
- EqualityArray.cs
- FlowLayoutPanel.cs
- XmlNamespaceDeclarationsAttribute.cs
- BinarySerializer.cs
- NullEntityWrapper.cs
- GlobalEventManager.cs
- Converter.cs
- PersonalizationStateQuery.cs
- DecimalAnimationBase.cs
- TabControlCancelEvent.cs
- DiagnosticTraceSource.cs
- _NegotiateClient.cs
- TimeManager.cs
- XPSSignatureDefinition.cs
- TreeChangeInfo.cs
- EventToken.cs
- login.cs
- SqlRowUpdatingEvent.cs
- SafeEventLogReadHandle.cs
- SqlConnectionString.cs
- BlurEffect.cs
- CacheVirtualItemsEvent.cs
- NativeMethods.cs
- ServiceModelActivity.cs
- RadioButtonList.cs
- WebBrowserProgressChangedEventHandler.cs
- VectorCollectionConverter.cs
- hebrewshape.cs
- XamlTypeMapper.cs
- ToolStripEditorManager.cs
- HwndSubclass.cs
- XmlQueryOutput.cs
- XmlException.cs
- CodeParameterDeclarationExpression.cs
- _LazyAsyncResult.cs
- UInt64Converter.cs
- OptimalTextSource.cs
- BuildProviderUtils.cs
- PageThemeCodeDomTreeGenerator.cs
- ExecutedRoutedEventArgs.cs
- GridViewRowEventArgs.cs
- Atom10FeedFormatter.cs
- SoapIncludeAttribute.cs
- GenericTypeParameterConverter.cs
- RSAPKCS1SignatureFormatter.cs
- MsmqIntegrationSecurityMode.cs
- SecurityKeyIdentifier.cs
- ToolboxControl.cs
- AttributeCallbackBuilder.cs
- MessageQueueException.cs
- newinstructionaction.cs
- AssertSection.cs
- SqlNotificationEventArgs.cs
- TrackingRecordPreFilter.cs
- PopOutPanel.cs
- DataGridViewColumnCollectionDialog.cs
- CompositeControl.cs
- OleDbStruct.cs
- DataPagerFieldCommandEventArgs.cs
- ConnectionPoolManager.cs
- Win32KeyboardDevice.cs
- QuaternionAnimationBase.cs
- FSWPathEditor.cs
- SessionViewState.cs
- NetSectionGroup.cs
- RadioButtonStandardAdapter.cs
- HotSpot.cs
- OracleConnectionString.cs
- BezierSegment.cs
- ColorConvertedBitmap.cs
- odbcmetadatacolumnnames.cs
- DispatcherExceptionFilterEventArgs.cs
- DateRangeEvent.cs
- SerialPort.cs
- PartialToken.cs
- MatrixAnimationUsingPath.cs
- ObjectPersistData.cs
- MailMessage.cs
- DataPointer.cs
- DateRangeEvent.cs
- SafeSecurityHandles.cs
- KnownTypesProvider.cs
- TextEditorParagraphs.cs
- FloatSumAggregationOperator.cs
- EpmAttributeNameBuilder.cs
- SiblingIterators.cs
- MessageOperationFormatter.cs
- SaveFileDialog.cs
- ReadOnlyDictionary.cs
- LateBoundBitmapDecoder.cs
- MatrixAnimationUsingPath.cs
- SQLInt64.cs
- LocationInfo.cs
- Type.cs
- GeneralTransform2DTo3D.cs
- QilGenerator.cs
- ExclusiveCanonicalizationTransform.cs