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
- DelegateTypeInfo.cs
- BuildProvider.cs
- ProbeDuplex11AsyncResult.cs
- ProvidersHelper.cs
- OleDbParameter.cs
- InkCollectionBehavior.cs
- ComboBox.cs
- FrameworkName.cs
- IBuiltInEvidence.cs
- EntityDataSource.cs
- EntityTypeEmitter.cs
- CompositeActivityCodeGenerator.cs
- SoapException.cs
- FixedElement.cs
- RelatedPropertyManager.cs
- MessageSmuggler.cs
- KoreanCalendar.cs
- ClientCultureInfo.cs
- XPathNavigator.cs
- WebServiceReceive.cs
- File.cs
- PassportAuthenticationEventArgs.cs
- NewArray.cs
- ConnectionPoint.cs
- UnsupportedPolicyOptionsException.cs
- TraceUtility.cs
- ConstructorExpr.cs
- HttpListenerRequest.cs
- FilterElement.cs
- NotifyParentPropertyAttribute.cs
- ISessionStateStore.cs
- MessageQueueCriteria.cs
- CursorConverter.cs
- DataGridViewLayoutData.cs
- StateMachine.cs
- TimeSpanStorage.cs
- EntityContainerEntitySet.cs
- PersonalizationAdministration.cs
- HttpHeaderCollection.cs
- WebPartConnectionsEventArgs.cs
- PerformanceCountersElement.cs
- MediaPlayerState.cs
- OLEDB_Util.cs
- RemotingConfiguration.cs
- ColorPalette.cs
- KeyedByTypeCollection.cs
- AccessText.cs
- FileRecordSequenceHelper.cs
- CorrelationTokenInvalidatedHandler.cs
- PortCache.cs
- RuntimeCompatibilityAttribute.cs
- QueryAccessibilityHelpEvent.cs
- ModulesEntry.cs
- _FixedSizeReader.cs
- TypeConverter.cs
- DES.cs
- ChannelServices.cs
- DynamicILGenerator.cs
- XmlSequenceWriter.cs
- TextDecorationCollectionConverter.cs
- ScriptReferenceEventArgs.cs
- BitmapEffectGeneralTransform.cs
- smtppermission.cs
- RC2CryptoServiceProvider.cs
- DispatcherOperation.cs
- ToolStripSeparator.cs
- MailMessageEventArgs.cs
- RecommendedAsConfigurableAttribute.cs
- AnnotationAuthorChangedEventArgs.cs
- DESCryptoServiceProvider.cs
- SqlMethods.cs
- GridItemCollection.cs
- HandlerWithFactory.cs
- Vector3DAnimationBase.cs
- Marshal.cs
- EncoderParameters.cs
- DbParameterCollection.cs
- Expressions.cs
- CodeExpressionStatement.cs
- XmlSerializationReader.cs
- LinkConverter.cs
- Scanner.cs
- GeneralTransform3D.cs
- SiteMapPath.cs
- XmlSchemaAll.cs
- XmlHelper.cs
- MatchingStyle.cs
- ContactManager.cs
- PersonalizationState.cs
- ColumnResizeAdorner.cs
- DocumentPaginator.cs
- NavigationWindowAutomationPeer.cs
- PeerNearMe.cs
- D3DImage.cs
- CapabilitiesState.cs
- ParamArrayAttribute.cs
- Converter.cs
- ClosableStream.cs
- SharedPerformanceCounter.cs
- RuleSettingsCollection.cs