Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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"; } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StrongBox.cs
- CodeAttributeDeclaration.cs
- StringAnimationUsingKeyFrames.cs
- RunWorkerCompletedEventArgs.cs
- TextElementEnumerator.cs
- XmlLoader.cs
- VersionPair.cs
- MarkupCompilePass2.cs
- AppDomainFactory.cs
- DataGridViewUtilities.cs
- StateChangeEvent.cs
- HtmlAnchor.cs
- UnsafeNativeMethods.cs
- XmlSchemaCollection.cs
- PassportAuthenticationEventArgs.cs
- Keywords.cs
- PathSegment.cs
- SafeSecurityHandles.cs
- RestClientProxyHandler.cs
- ProbeDuplexAsyncResult.cs
- IntellisenseTextBox.cs
- Schema.cs
- SymmetricKeyWrap.cs
- WebPartsSection.cs
- FileDialog_Vista.cs
- PassportAuthenticationEventArgs.cs
- RangeValidator.cs
- PresentationAppDomainManager.cs
- CriticalFinalizerObject.cs
- WebPartMenu.cs
- PersonalizationProviderHelper.cs
- SchemaCollectionPreprocessor.cs
- PathGradientBrush.cs
- NativeMethods.cs
- DelegateHelpers.cs
- TreeViewImageIndexConverter.cs
- Boolean.cs
- MenuEventArgs.cs
- ImpersonationContext.cs
- GlyphTypeface.cs
- ReadOnlyDictionary.cs
- processwaithandle.cs
- RadioButtonPopupAdapter.cs
- InProcStateClientManager.cs
- WindowsSlider.cs
- BStrWrapper.cs
- TextEffect.cs
- TrackingAnnotationCollection.cs
- MachineKeySection.cs
- ConfigXmlWhitespace.cs
- hwndwrapper.cs
- HandlerFactoryCache.cs
- SemanticKeyElement.cs
- ADMembershipProvider.cs
- WmlImageAdapter.cs
- SessionState.cs
- PropertyDescriptorComparer.cs
- TraceSection.cs
- ErrorWebPart.cs
- EntityDataSourceContextCreatingEventArgs.cs
- xdrvalidator.cs
- WebPartCollection.cs
- SqlGatherConsumedAliases.cs
- AccessDataSourceView.cs
- NumericUpDownAcceleration.cs
- ProviderException.cs
- DocumentViewer.cs
- MaskDesignerDialog.cs
- Comparer.cs
- NetCodeGroup.cs
- TransformerTypeCollection.cs
- tooltip.cs
- Enum.cs
- CopyAction.cs
- Processor.cs
- ListViewGroup.cs
- TypeHelpers.cs
- TextParaClient.cs
- FunctionDetailsReader.cs
- DependencyPropertyHelper.cs
- EllipseGeometry.cs
- NonSerializedAttribute.cs
- Baml2006KeyRecord.cs
- RadioButtonFlatAdapter.cs
- XPathDocument.cs
- XMLUtil.cs
- CqlWriter.cs
- TimeSpanStorage.cs
- ProxySimple.cs
- AuthorizationRule.cs
- ListItemParagraph.cs
- SqlTriggerContext.cs
- CAGDesigner.cs
- TypeGeneratedEventArgs.cs
- InputBindingCollection.cs
- XmlQualifiedNameTest.cs
- AsyncPostBackTrigger.cs
- DesignerSerializerAttribute.cs
- Win32KeyboardDevice.cs
- ItemCollection.cs