Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / clr / src / BCL / System / Security / Cryptography / DSASignatureFormatter.cs / 1 / DSASignatureFormatter.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // DSASignatureFormatter.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class DSASignatureFormatter : AsymmetricSignatureFormatter { DSA _dsaKey; String _oid; // // public constructors // public DSASignatureFormatter() { // The hash algorithm is always SHA1 _oid = CryptoConfig.MapNameToOID("SHA1"); } public DSASignatureFormatter(AsymmetricAlgorithm key) : this() { if (key == null) throw new ArgumentNullException("key"); _dsaKey = (DSA) key; } // // public methods // public override void SetKey(AsymmetricAlgorithm key) { if (key == null) throw new ArgumentNullException("key"); _dsaKey = (DSA) key; } public override void SetHashAlgorithm(String strName) { if (CryptoConfig.MapNameToOID(strName) != _oid) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_InvalidOperation")); } public override byte[] CreateSignature(byte[] rgbHash) { if (_oid == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingOID")); if (_dsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); if (rgbHash == null) throw new ArgumentNullException("rgbHash"); return _dsaKey.CreateSignature(rgbHash); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // DSASignatureFormatter.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class DSASignatureFormatter : AsymmetricSignatureFormatter { DSA _dsaKey; String _oid; // // public constructors // public DSASignatureFormatter() { // The hash algorithm is always SHA1 _oid = CryptoConfig.MapNameToOID("SHA1"); } public DSASignatureFormatter(AsymmetricAlgorithm key) : this() { if (key == null) throw new ArgumentNullException("key"); _dsaKey = (DSA) key; } // // public methods // public override void SetKey(AsymmetricAlgorithm key) { if (key == null) throw new ArgumentNullException("key"); _dsaKey = (DSA) key; } public override void SetHashAlgorithm(String strName) { if (CryptoConfig.MapNameToOID(strName) != _oid) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_InvalidOperation")); } public override byte[] CreateSignature(byte[] rgbHash) { if (_oid == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingOID")); if (_dsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); if (rgbHash == null) throw new ArgumentNullException("rgbHash"); return _dsaKey.CreateSignature(rgbHash); } } } // 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
- StandardToolWindows.cs
- WebColorConverter.cs
- TextEditor.cs
- OptimizedTemplateContentHelper.cs
- TextBoxRenderer.cs
- FileLoadException.cs
- MetadataItemCollectionFactory.cs
- Effect.cs
- ToolStripContainer.cs
- CollectionType.cs
- PcmConverter.cs
- TypeConverterHelper.cs
- TextRunCache.cs
- PreservationFileWriter.cs
- EntityContainerAssociationSet.cs
- PointHitTestParameters.cs
- HtmlTitle.cs
- ThreadAttributes.cs
- ContractBase.cs
- ConnectionString.cs
- NullableIntSumAggregationOperator.cs
- SqlVersion.cs
- AutoScrollHelper.cs
- XmlSchemaNotation.cs
- CustomValidator.cs
- XmlDocumentViewSchema.cs
- SqlClientPermission.cs
- SiteMapProvider.cs
- ListViewItem.cs
- SingleConverter.cs
- PermissionAttributes.cs
- SrgsNameValueTag.cs
- XmlDocumentSurrogate.cs
- FontStyleConverter.cs
- DiscoveryService.cs
- WinFormsSpinner.cs
- SecureEnvironment.cs
- LocalizationParserHooks.cs
- DockingAttribute.cs
- SeverityFilter.cs
- TabItemWrapperAutomationPeer.cs
- RawStylusInputCustomDataList.cs
- PreservationFileReader.cs
- SmtpLoginAuthenticationModule.cs
- WCFModelStrings.Designer.cs
- Msmq.cs
- VScrollBar.cs
- FigureParaClient.cs
- BinaryMessageFormatter.cs
- SrgsGrammar.cs
- SectionInput.cs
- NamespaceInfo.cs
- ListViewItem.cs
- ServiceXNameTypeConverter.cs
- QueryCreatedEventArgs.cs
- DynamicPropertyReader.cs
- StylusTip.cs
- XMLSyntaxException.cs
- XslCompiledTransform.cs
- TargetControlTypeCache.cs
- EntityDataSourceContextCreatedEventArgs.cs
- PriorityItem.cs
- HttpDebugHandler.cs
- Classification.cs
- CodeDirectionExpression.cs
- HashCodeCombiner.cs
- TaiwanCalendar.cs
- SystemDiagnosticsSection.cs
- WindowsListBox.cs
- PaintValueEventArgs.cs
- ReliableSessionBindingElement.cs
- PromptEventArgs.cs
- TreeViewCancelEvent.cs
- PixelShader.cs
- SimplePropertyEntry.cs
- XpsS0ValidatingLoader.cs
- MaskPropertyEditor.cs
- uribuilder.cs
- MenuItemCollection.cs
- ConstraintStruct.cs
- CustomValidator.cs
- IODescriptionAttribute.cs
- AliasExpr.cs
- WindowsTab.cs
- DataGridViewCellParsingEventArgs.cs
- TextBoxBase.cs
- X509CertificateValidationMode.cs
- CatalogZone.cs
- AsyncOperation.cs
- DirtyTextRange.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- MetafileHeader.cs
- Vector3D.cs
- ReadOnlyHierarchicalDataSource.cs
- DataGridRow.cs
- ShapingEngine.cs
- LinkedDataMemberFieldEditor.cs
- MimeMultiPart.cs
- MultipleFilterMatchesException.cs
- CustomErrorsSectionWrapper.cs