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
- oledbmetadatacolumnnames.cs
- PropertyInfo.cs
- MemberRelationshipService.cs
- AppDomainManager.cs
- SimpleHandlerBuildProvider.cs
- FormViewActionList.cs
- LineBreakRecord.cs
- IgnoreFlushAndCloseStream.cs
- CrossSiteScriptingValidation.cs
- RevocationPoint.cs
- xml.cs
- DataGridViewRowsAddedEventArgs.cs
- Pool.cs
- securitycriticaldata.cs
- NonBatchDirectoryCompiler.cs
- Point3DConverter.cs
- CatalogZone.cs
- TreeNodeCollection.cs
- SchemaElementDecl.cs
- RevocationPoint.cs
- RangeContentEnumerator.cs
- DiagnosticTrace.cs
- DbDataRecord.cs
- Journaling.cs
- ListSourceHelper.cs
- ItemsControlAutomationPeer.cs
- DateTimeConverter.cs
- XhtmlBasicLinkAdapter.cs
- OutputScopeManager.cs
- MediaPlayerState.cs
- Inline.cs
- ItemCollectionEditor.cs
- Form.cs
- TextStore.cs
- CatalogPartChrome.cs
- WhileDesigner.cs
- FixedSOMGroup.cs
- LeftCellWrapper.cs
- ResXBuildProvider.cs
- PropertyConverter.cs
- XmlILModule.cs
- BitmapFrame.cs
- TypeUnloadedException.cs
- SchemaMapping.cs
- OleDbException.cs
- SubMenuStyle.cs
- ZipFileInfoCollection.cs
- CodeAttributeArgumentCollection.cs
- ListViewDeletedEventArgs.cs
- Util.cs
- DataTrigger.cs
- PEFileReader.cs
- PrefixQName.cs
- FileDialog.cs
- SqlCacheDependencySection.cs
- CustomErrorsSection.cs
- SocketException.cs
- AuthenticationModuleElementCollection.cs
- DtdParser.cs
- ProxyGenerationError.cs
- SqlNotificationEventArgs.cs
- ReflectPropertyDescriptor.cs
- ServiceOperation.cs
- ImportCatalogPart.cs
- SliderAutomationPeer.cs
- ActivityBindForm.cs
- LoadItemsEventArgs.cs
- Int64AnimationUsingKeyFrames.cs
- Command.cs
- WindowsListViewGroupSubsetLink.cs
- HttpRawResponse.cs
- Pen.cs
- WebPartMovingEventArgs.cs
- ClientUrlResolverWrapper.cs
- FileStream.cs
- ScrollChrome.cs
- RequestValidator.cs
- WebPartDisplayModeEventArgs.cs
- OdbcConnectionString.cs
- MimeWriter.cs
- TrackingProfile.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- XMLSyntaxException.cs
- WpfWebRequestHelper.cs
- Root.cs
- BinaryFormatter.cs
- Slider.cs
- TreeNodeSelectionProcessor.cs
- ImpersonationContext.cs
- XmlSchemaValidator.cs
- sqlcontext.cs
- TemplateParser.cs
- ItemsControlAutomationPeer.cs
- ItemAutomationPeer.cs
- SqlDataSource.cs
- EdmError.cs
- FixedSOMTableRow.cs
- VariableAction.cs
- ComponentEditorPage.cs
- PolyLineSegmentFigureLogic.cs