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
- BitStack.cs
- XPathConvert.cs
- RootNamespaceAttribute.cs
- BidirectionalDictionary.cs
- IPAddressCollection.cs
- PublisherMembershipCondition.cs
- NotifyInputEventArgs.cs
- DataGridItemCollection.cs
- SqlException.cs
- DecoderExceptionFallback.cs
- PowerStatus.cs
- ConstrainedDataObject.cs
- ClientCredentialsElement.cs
- ListItemCollection.cs
- Point3DCollection.cs
- TextBoxAutomationPeer.cs
- FileDialog.cs
- WebPartCollection.cs
- SmiContext.cs
- DispatchChannelSink.cs
- XmlDictionaryWriter.cs
- Certificate.cs
- SmtpAuthenticationManager.cs
- QilIterator.cs
- CorrelationInitializer.cs
- SelectQueryOperator.cs
- GradientStopCollection.cs
- BinaryObjectInfo.cs
- LookupBindingPropertiesAttribute.cs
- ParseChildrenAsPropertiesAttribute.cs
- BitmapEffectvisualstate.cs
- SQLMoney.cs
- ConnectionManager.cs
- SimpleApplicationHost.cs
- ClientUtils.cs
- IFlowDocumentViewer.cs
- EntityConnectionStringBuilder.cs
- GroupBox.cs
- WebPartExportVerb.cs
- PixelFormat.cs
- HttpInputStream.cs
- ObjectSet.cs
- HttpServerVarsCollection.cs
- ProfileSettings.cs
- FrameworkElement.cs
- XpsS0ValidatingLoader.cs
- TextTreeExtractElementUndoUnit.cs
- ProfileProvider.cs
- FrugalList.cs
- SelectionItemPattern.cs
- WebServiceEnumData.cs
- Triplet.cs
- AddValidationError.cs
- SplashScreenNativeMethods.cs
- WebDisplayNameAttribute.cs
- RIPEMD160Managed.cs
- NewArray.cs
- InkCanvasSelectionAdorner.cs
- ImageConverter.cs
- ContainerUtilities.cs
- SqlMultiplexer.cs
- OleDbErrorCollection.cs
- Opcode.cs
- _NestedSingleAsyncResult.cs
- RsaKeyIdentifierClause.cs
- StringWriter.cs
- IPAddressCollection.cs
- MetadataArtifactLoaderFile.cs
- XomlDesignerLoader.cs
- ConnectionPointCookie.cs
- RelationshipManager.cs
- RoleManagerSection.cs
- DtrList.cs
- RequestQueue.cs
- ProtectedConfiguration.cs
- CommandSet.cs
- Button.cs
- BufferedGraphicsContext.cs
- XmlSerializationReader.cs
- ButtonColumn.cs
- SqlRowUpdatingEvent.cs
- OperationContractAttribute.cs
- SqlConnectionPoolProviderInfo.cs
- PkcsMisc.cs
- WindowCollection.cs
- Root.cs
- MultipleViewPattern.cs
- ProfileParameter.cs
- EntityDataSourceDesignerHelper.cs
- VisualCollection.cs
- EnumMember.cs
- InvalidWMPVersionException.cs
- Compilation.cs
- GeneralTransform3DCollection.cs
- MessageDirection.cs
- SqlDataSourceFilteringEventArgs.cs
- HMACSHA384.cs
- QueryException.cs
- EntityDataSourceColumn.cs
- RoleManagerSection.cs