Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- XmlAttributeOverrides.cs
- TypeCacheManager.cs
- OleDbWrapper.cs
- ResolvedKeyFrameEntry.cs
- AsymmetricKeyExchangeFormatter.cs
- OpCopier.cs
- ControlBuilder.cs
- TextContainerHelper.cs
- ServiceParser.cs
- HttpResponse.cs
- DtdParser.cs
- Int16AnimationUsingKeyFrames.cs
- CoreSwitches.cs
- LoadedEvent.cs
- KeyNotFoundException.cs
- Graph.cs
- SqlCacheDependencyDatabaseCollection.cs
- IdentityModelDictionary.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ClosableStream.cs
- ParseChildrenAsPropertiesAttribute.cs
- OAVariantLib.cs
- ViewKeyConstraint.cs
- WebBrowser.cs
- MouseBinding.cs
- KeyedCollection.cs
- iisPickupDirectory.cs
- LineProperties.cs
- StylusPoint.cs
- EventDescriptorCollection.cs
- SystemGatewayIPAddressInformation.cs
- SafeRightsManagementEnvironmentHandle.cs
- CapabilitiesState.cs
- TextElementAutomationPeer.cs
- MDIWindowDialog.cs
- QuaternionRotation3D.cs
- TagPrefixCollection.cs
- ObjectDisposedException.cs
- StringExpressionSet.cs
- BitmapImage.cs
- WindowsStatic.cs
- ConfigurationStrings.cs
- ServiceDescription.cs
- ControlSerializer.cs
- StreamedWorkflowDefinitionContext.cs
- TargetConverter.cs
- FileDialogCustomPlacesCollection.cs
- TextElementCollection.cs
- CancellationTokenRegistration.cs
- XsdValidatingReader.cs
- GridViewAutomationPeer.cs
- ResetableIterator.cs
- SpotLight.cs
- ExcCanonicalXml.cs
- ProviderBase.cs
- Composition.cs
- SpellerInterop.cs
- NamespaceList.cs
- ColorMap.cs
- ImageList.cs
- ContentOperations.cs
- _SslState.cs
- InternalDuplexChannelFactory.cs
- CompilerGeneratedAttribute.cs
- RightsManagementProvider.cs
- URL.cs
- CustomErrorsSectionWrapper.cs
- FileRecordSequenceCompletedAsyncResult.cs
- RuleSettingsCollection.cs
- ExpandCollapsePatternIdentifiers.cs
- ErrorRuntimeConfig.cs
- DesignerForm.cs
- SqlDataSourceView.cs
- GeometryDrawing.cs
- VectorAnimationUsingKeyFrames.cs
- JumpItem.cs
- DataKeyArray.cs
- Journal.cs
- StackOverflowException.cs
- TypeBuilderInstantiation.cs
- RegexCompilationInfo.cs
- SearchForVirtualItemEventArgs.cs
- Opcode.cs
- HandoffBehavior.cs
- InheritanceAttribute.cs
- XmlDocumentType.cs
- DataServiceEntityAttribute.cs
- ResourcePermissionBase.cs
- ComponentCommands.cs
- HScrollBar.cs
- HttpCacheVaryByContentEncodings.cs
- PropertyEmitterBase.cs
- SqlCacheDependencySection.cs
- UserPersonalizationStateInfo.cs
- ApplicationInfo.cs
- COM2EnumConverter.cs
- CounterSampleCalculator.cs
- SQLBytesStorage.cs
- Rect3D.cs
- VectorAnimationBase.cs