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

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SerializerWriterEventHandlers.cs
- AsymmetricKeyExchangeDeformatter.cs
- BindStream.cs
- SEHException.cs
- TableLayout.cs
- SplitContainerDesigner.cs
- SelectionUIHandler.cs
- DBCommand.cs
- DataGridView.cs
- ToolStripComboBox.cs
- StructuralType.cs
- ToolboxItem.cs
- Package.cs
- xml.cs
- TransformerTypeCollection.cs
- BooleanProjectedSlot.cs
- XXXOnTypeBuilderInstantiation.cs
- ASCIIEncoding.cs
- WebPartDescriptionCollection.cs
- EnumerableRowCollectionExtensions.cs
- FillBehavior.cs
- OleDbPropertySetGuid.cs
- XamlRtfConverter.cs
- LogEntrySerializer.cs
- Crypto.cs
- SaveFileDialog.cs
- Queue.cs
- AssociationProvider.cs
- StructuredTypeEmitter.cs
- NativeMethods.cs
- Normalization.cs
- CircleHotSpot.cs
- ButtonPopupAdapter.cs
- FileReader.cs
- SocketInformation.cs
- clipboard.cs
- newinstructionaction.cs
- CompleteWizardStep.cs
- ExtenderProvidedPropertyAttribute.cs
- NestedContainer.cs
- EnumType.cs
- DrawingImage.cs
- MethodImplAttribute.cs
- ListMarkerLine.cs
- ReachDocumentSequenceSerializerAsync.cs
- DataControlLinkButton.cs
- SecurityContext.cs
- Visual3D.cs
- DisplayNameAttribute.cs
- DataSourceHelper.cs
- PageDeviceFont.cs
- ArglessEventHandlerProxy.cs
- OleDbMetaDataFactory.cs
- IChannel.cs
- FileAuthorizationModule.cs
- DBDataPermission.cs
- SslStreamSecurityUpgradeProvider.cs
- ObjectParameterCollection.cs
- InOutArgumentConverter.cs
- ColorPalette.cs
- Matrix3DStack.cs
- GetWinFXPath.cs
- AppDomainCompilerProxy.cs
- SectionRecord.cs
- ServiceModelConfigurationSectionGroup.cs
- DecimalAnimation.cs
- FormattedText.cs
- IList.cs
- WSDualHttpBinding.cs
- StorageModelBuildProvider.cs
- GridSplitterAutomationPeer.cs
- AnnotationResourceChangedEventArgs.cs
- BitmapEffectInputConnector.cs
- SerializerDescriptor.cs
- ToolStripCollectionEditor.cs
- Track.cs
- MessageUtil.cs
- SponsorHelper.cs
- Pen.cs
- StringExpressionSet.cs
- ContractReference.cs
- FacetValues.cs
- WinFormsSecurity.cs
- PolicyLevel.cs
- EditingCommands.cs
- Version.cs
- MorphHelper.cs
- RotateTransform.cs
- HwndProxyElementProvider.cs
- CuspData.cs
- SkipQueryOptionExpression.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- IdentityHolder.cs
- NonBatchDirectoryCompiler.cs
- SqlTriggerAttribute.cs
- RemoteWebConfigurationHostStream.cs
- TextUtf8RawTextWriter.cs
- PromptEventArgs.cs
- DataControlLinkButton.cs
- SettingsProperty.cs