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
- XmlObjectSerializerReadContextComplex.cs
- ByteStack.cs
- ReflectionPermission.cs
- DecoderExceptionFallback.cs
- VSWCFServiceContractGenerator.cs
- BitmapPalettes.cs
- ProgramNode.cs
- GeometryGroup.cs
- UpdatePanelControlTrigger.cs
- MatrixConverter.cs
- AdjustableArrowCap.cs
- LinkButton.cs
- Line.cs
- OutputScope.cs
- ResourceExpressionBuilder.cs
- AmbientProperties.cs
- DataGridViewColumnCollection.cs
- DataRowChangeEvent.cs
- OracleRowUpdatingEventArgs.cs
- SvcMapFileLoader.cs
- WindowsListViewGroupSubsetLink.cs
- WebPartDisplayModeEventArgs.cs
- AnnotationAdorner.cs
- FontSource.cs
- GeometryCollection.cs
- WebServiceBindingAttribute.cs
- AudioException.cs
- DrawListViewSubItemEventArgs.cs
- KeyboardNavigation.cs
- HotSpot.cs
- XmlnsDictionary.cs
- SqlDataSourceCommandEventArgs.cs
- TextDecorationUnitValidation.cs
- DispatcherSynchronizationContext.cs
- MouseBinding.cs
- EntityContainerEmitter.cs
- LineSegment.cs
- CheckBox.cs
- PackWebRequestFactory.cs
- SendContent.cs
- _SafeNetHandles.cs
- ChineseLunisolarCalendar.cs
- Inline.cs
- TcpDuplicateContext.cs
- SqlCrossApplyToCrossJoin.cs
- GuidelineCollection.cs
- PathData.cs
- DataGridViewCellConverter.cs
- ObjectDataSource.cs
- LocalizableAttribute.cs
- HWStack.cs
- FixedSOMLineCollection.cs
- SystemIPInterfaceProperties.cs
- ProfileManager.cs
- SspiHelper.cs
- ListParagraph.cs
- WeakEventManager.cs
- SystemIcmpV6Statistics.cs
- SortQuery.cs
- ZipArchive.cs
- HitTestWithGeometryDrawingContextWalker.cs
- ObjectQuery.cs
- XmlQueryType.cs
- ItemMap.cs
- HttpHeaderCollection.cs
- ResourceDictionaryCollection.cs
- CurrencyManager.cs
- LicFileLicenseProvider.cs
- MetadataPropertyCollection.cs
- Application.cs
- CodeAttachEventStatement.cs
- QueryStatement.cs
- EnglishPluralizationService.cs
- SqlDataSourceSelectingEventArgs.cs
- DesignBindingPicker.cs
- AppearanceEditorPart.cs
- DESCryptoServiceProvider.cs
- TextCompositionEventArgs.cs
- UiaCoreProviderApi.cs
- Normalization.cs
- StylusButtonCollection.cs
- TcpWorkerProcess.cs
- QueryCursorEventArgs.cs
- ToolStripPanelRow.cs
- MarkupCompilePass1.cs
- RewritingValidator.cs
- LocalizableAttribute.cs
- PrimitiveCodeDomSerializer.cs
- TransactionInterop.cs
- TemplateBindingExpression.cs
- AQNBuilder.cs
- PageAsyncTaskManager.cs
- SharedPerformanceCounter.cs
- WebPartCollection.cs
- ComNativeDescriptor.cs
- TreeView.cs
- BaseConfigurationRecord.cs
- XmlSchemas.cs
- TrustLevelCollection.cs
- ClosureBinding.cs