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
- SettingsBindableAttribute.cs
- StateDesigner.cs
- AssemblyHash.cs
- ViewStateChangedEventArgs.cs
- BuildDependencySet.cs
- GetTokenRequest.cs
- WithStatement.cs
- UriExt.cs
- SelectorItemAutomationPeer.cs
- TrackingProfileCache.cs
- WebCodeGenerator.cs
- Vector3DCollectionConverter.cs
- UnionCodeGroup.cs
- PageStatePersister.cs
- ReadOnlyState.cs
- DbParameterHelper.cs
- InArgumentConverter.cs
- TokenizerHelper.cs
- UrlPath.cs
- ICspAsymmetricAlgorithm.cs
- SecurityDescriptor.cs
- BoolExpressionVisitors.cs
- UriWriter.cs
- DataPagerField.cs
- UInt16.cs
- DocumentSequenceHighlightLayer.cs
- ResourceContainer.cs
- SpotLight.cs
- OdbcConnectionPoolProviderInfo.cs
- MarkupCompilePass1.cs
- ButtonFieldBase.cs
- SHA512Managed.cs
- ToolStripSeparator.cs
- PassportIdentity.cs
- DLinqDataModelProvider.cs
- EmptyControlCollection.cs
- ConfigurationPropertyAttribute.cs
- PointCollection.cs
- WorkflowIdleBehavior.cs
- DebugControllerThread.cs
- Rights.cs
- CollectionView.cs
- FilteredAttributeCollection.cs
- BitmapCacheBrush.cs
- figurelength.cs
- ColorInterpolationModeValidation.cs
- MULTI_QI.cs
- EntityProviderServices.cs
- AsyncPostBackTrigger.cs
- PageThemeParser.cs
- DependencyObjectType.cs
- HtmlControlPersistable.cs
- Cast.cs
- ZipQueryOperator.cs
- Rfc4050KeyFormatter.cs
- Constraint.cs
- SafeNativeMethods.cs
- JapaneseLunisolarCalendar.cs
- QualifiedCellIdBoolean.cs
- COM2ColorConverter.cs
- DataGridViewBindingCompleteEventArgs.cs
- SecureConversationDriver.cs
- NTAccount.cs
- DataGridViewComboBoxColumn.cs
- ColorConverter.cs
- oledbconnectionstring.cs
- MouseButtonEventArgs.cs
- MimeTypeMapper.cs
- TimeoutException.cs
- ScriptIgnoreAttribute.cs
- ThicknessAnimationBase.cs
- URL.cs
- ManipulationStartedEventArgs.cs
- JsonStringDataContract.cs
- InputMethod.cs
- DoubleCollection.cs
- SettingsSavedEventArgs.cs
- LostFocusEventManager.cs
- LicFileLicenseProvider.cs
- StreamUpgradeProvider.cs
- NavigatorInput.cs
- InlineUIContainer.cs
- DataGridItem.cs
- PublisherMembershipCondition.cs
- SemaphoreSecurity.cs
- ExtensionWindowResizeGrip.cs
- WCFServiceClientProxyGenerator.cs
- WebServiceResponse.cs
- ToolStripButton.cs
- UnsafeNativeMethods.cs
- EntityDataSourceContextDisposingEventArgs.cs
- TableRowCollection.cs
- SQLInt16Storage.cs
- SQLRoleProvider.cs
- SqlWriter.cs
- ChannelFactoryBase.cs
- _Events.cs
- DependencyObjectType.cs
- OdbcPermission.cs
- EntityDataSourceValidationException.cs