Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BitSet.cs
- Padding.cs
- xmlglyphRunInfo.cs
- DataRow.cs
- ReflectionUtil.cs
- SelectionHighlightInfo.cs
- PathGeometry.cs
- WorkflowDebuggerSteppingAttribute.cs
- GradientBrush.cs
- MetafileHeaderWmf.cs
- APCustomTypeDescriptor.cs
- IncrementalCompileAnalyzer.cs
- Source.cs
- FormattedText.cs
- GenericWebPart.cs
- CodePropertyReferenceExpression.cs
- KeyValueSerializer.cs
- EditorPart.cs
- ArraySet.cs
- ContextQuery.cs
- StartUpEventArgs.cs
- SqlHelper.cs
- XmlAttribute.cs
- templategroup.cs
- SQLMembershipProvider.cs
- StylusPlugin.cs
- ListViewItem.cs
- ItemCheckEvent.cs
- HealthMonitoringSection.cs
- DataGridViewEditingControlShowingEventArgs.cs
- SqlStatistics.cs
- ProcessHostMapPath.cs
- ToolStripDropDownItem.cs
- ScrollChangedEventArgs.cs
- ObjectConverter.cs
- CurrentChangingEventManager.cs
- TrackBarRenderer.cs
- Schema.cs
- ResourcesGenerator.cs
- HierarchicalDataBoundControlAdapter.cs
- BufferModeSettings.cs
- HtmlTableCellCollection.cs
- GregorianCalendar.cs
- WebPartEventArgs.cs
- SqlClientMetaDataCollectionNames.cs
- AuthenticationSection.cs
- DrawItemEvent.cs
- FileLogRecordStream.cs
- ConfigXmlSignificantWhitespace.cs
- DropDownButton.cs
- HostingPreferredMapPath.cs
- ConfigXmlCDataSection.cs
- X509Logo.cs
- MediaEntryAttribute.cs
- ConditionalDesigner.cs
- Clock.cs
- ImageSourceConverter.cs
- TypeForwardedToAttribute.cs
- MessageQueuePermissionEntry.cs
- Literal.cs
- ReturnValue.cs
- PolyBezierSegment.cs
- SqlFacetAttribute.cs
- PenThreadPool.cs
- Stackframe.cs
- DiagnosticTraceSource.cs
- CompositeActivityValidator.cs
- _NetworkingPerfCounters.cs
- X509CertificateChain.cs
- TreeChangeInfo.cs
- StatusBar.cs
- SmiMetaDataProperty.cs
- MinMaxParagraphWidth.cs
- TemplateBuilder.cs
- WebDescriptionAttribute.cs
- EdmTypeAttribute.cs
- QuadraticBezierSegment.cs
- SqlFunctions.cs
- EncoderBestFitFallback.cs
- RegisteredHiddenField.cs
- ColorAnimation.cs
- UInt32.cs
- CapacityStreamGeometryContext.cs
- RangeValidator.cs
- PrivilegeNotHeldException.cs
- PrePostDescendentsWalker.cs
- XPathDocumentNavigator.cs
- ClosableStream.cs
- SqlCacheDependency.cs
- LoadRetryHandler.cs
- XmlArrayAttribute.cs
- ApplicationContext.cs
- MetaModel.cs
- TypeElementCollection.cs
- DataGridRow.cs
- UpdatePanelTrigger.cs
- RectIndependentAnimationStorage.cs
- BindingExpression.cs
- MappedMetaModel.cs
- PinnedBufferMemoryStream.cs