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
- CursorConverter.cs
- InvalidDataException.cs
- ThemeDirectoryCompiler.cs
- EmptyControlCollection.cs
- StatusBarPanel.cs
- AutomationIdentifier.cs
- DesignerVerb.cs
- XmlDownloadManager.cs
- TemplateXamlTreeBuilder.cs
- NextPreviousPagerField.cs
- KnownAssemblyEntry.cs
- TTSEngineTypes.cs
- DataViewManager.cs
- CompilationRelaxations.cs
- ErrorWrapper.cs
- GridViewUpdatedEventArgs.cs
- JsonMessageEncoderFactory.cs
- ConnectionStringEditor.cs
- InvalidateEvent.cs
- GridViewSortEventArgs.cs
- CryptoKeySecurity.cs
- ObjectConverter.cs
- WebCategoryAttribute.cs
- ConfigsHelper.cs
- SessionStateSection.cs
- Keyboard.cs
- MsmqIntegrationSecurity.cs
- ResourceReader.cs
- Matrix3DStack.cs
- ComponentResourceManager.cs
- LinqDataSourceUpdateEventArgs.cs
- HtmlTable.cs
- RowSpanVector.cs
- DispatcherObject.cs
- SudsWriter.cs
- ComponentEvent.cs
- OracleBoolean.cs
- SafeLocalMemHandle.cs
- DocumentDesigner.cs
- CalendarTable.cs
- FlowNode.cs
- ReferenceEqualityComparer.cs
- StorageFunctionMapping.cs
- DragDrop.cs
- ImageCodecInfoPrivate.cs
- OdbcConnectionHandle.cs
- HMACSHA384.cs
- XamlBrushSerializer.cs
- ClipboardProcessor.cs
- DeflateStream.cs
- ThicknessAnimation.cs
- HtmlInputText.cs
- DataGridBoolColumn.cs
- ConfigXmlText.cs
- ToolStripSettings.cs
- ValidationService.cs
- MediaSystem.cs
- TypeElement.cs
- DesignerCommandAdapter.cs
- WebBrowser.cs
- CompositionTarget.cs
- WebBrowserSiteBase.cs
- ConstructorExpr.cs
- ClientScriptManager.cs
- KnownTypesProvider.cs
- DataQuery.cs
- AsynchronousChannelMergeEnumerator.cs
- HttpModuleAction.cs
- BaseResourcesBuildProvider.cs
- PerfCounters.cs
- TypeConverterMarkupExtension.cs
- QueryContinueDragEvent.cs
- DataListCommandEventArgs.cs
- CodeGenHelper.cs
- UrlPath.cs
- ExternalCalls.cs
- EventMappingSettings.cs
- UpDownBase.cs
- IsolatedStorageException.cs
- VirtualizingStackPanel.cs
- DataRelation.cs
- SelectionItemProviderWrapper.cs
- DateRangeEvent.cs
- SymbolEqualComparer.cs
- GlyphsSerializer.cs
- Update.cs
- KoreanLunisolarCalendar.cs
- FormatConvertedBitmap.cs
- TdsParser.cs
- ToReply.cs
- DesignerAdapterAttribute.cs
- WebBaseEventKeyComparer.cs
- SpecularMaterial.cs
- HttpRuntime.cs
- XmlSchemaSimpleTypeUnion.cs
- FieldBuilder.cs
- OracleNumber.cs
- CharEntityEncoderFallback.cs
- SessionStateUtil.cs
- EventMappingSettings.cs