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
- COM2ColorConverter.cs
- HtmlFormParameterWriter.cs
- XmlEventCache.cs
- SetterBaseCollection.cs
- BasicAsyncResult.cs
- DecimalKeyFrameCollection.cs
- RequestCacheManager.cs
- LinqDataSourceUpdateEventArgs.cs
- DataViewManager.cs
- CompositeControl.cs
- Debug.cs
- DodSequenceMerge.cs
- WebPartDesigner.cs
- SHA1Managed.cs
- InfoCardX509Validator.cs
- DataGridViewSelectedRowCollection.cs
- AutoScrollExpandMessageFilter.cs
- MonitoringDescriptionAttribute.cs
- EntityPropertyMappingAttribute.cs
- FieldNameLookup.cs
- BinaryCommonClasses.cs
- ExpressionBuilderContext.cs
- MenuBase.cs
- WindowsTab.cs
- CompletionProxy.cs
- TextEmbeddedObject.cs
- AssociationSet.cs
- PerformanceCounters.cs
- FillErrorEventArgs.cs
- PointAnimationBase.cs
- LambdaCompiler.Lambda.cs
- DataRecordInternal.cs
- SqlServices.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- SqlUserDefinedTypeAttribute.cs
- RandomNumberGenerator.cs
- PropertyPushdownHelper.cs
- WmfPlaceableFileHeader.cs
- InstalledFontCollection.cs
- CodeStatementCollection.cs
- SqlTriggerAttribute.cs
- XmlIlTypeHelper.cs
- PaintEvent.cs
- DecoratedNameAttribute.cs
- TreeNodeBindingCollection.cs
- PingReply.cs
- ExpandedProjectionNode.cs
- EdmScalarPropertyAttribute.cs
- MasterPageCodeDomTreeGenerator.cs
- StoreItemCollection.Loader.cs
- BinaryObjectInfo.cs
- PenThreadPool.cs
- WindowsFormsSynchronizationContext.cs
- WebZone.cs
- StylusEventArgs.cs
- PropertyEntry.cs
- FormViewInsertEventArgs.cs
- CodeDelegateInvokeExpression.cs
- Errors.cs
- OleDbPropertySetGuid.cs
- HttpBufferlessInputStream.cs
- SqlDelegatedTransaction.cs
- ProfessionalColorTable.cs
- CopyCodeAction.cs
- NameValueCollection.cs
- AtomMaterializer.cs
- StdValidatorsAndConverters.cs
- DLinqDataModelProvider.cs
- _NestedMultipleAsyncResult.cs
- XmlNodeList.cs
- sqlmetadatafactory.cs
- PreloadedPackages.cs
- SignatureDescription.cs
- StateManagedCollection.cs
- Membership.cs
- DataReaderContainer.cs
- EndpointIdentityConverter.cs
- SiteOfOriginContainer.cs
- DesignerPainter.cs
- ValidationResult.cs
- CharConverter.cs
- FontEditor.cs
- ThreadStaticAttribute.cs
- FileDialogCustomPlacesCollection.cs
- uribuilder.cs
- SoapIgnoreAttribute.cs
- Int64KeyFrameCollection.cs
- UnsafeNativeMethods.cs
- CatalogPartChrome.cs
- ToggleProviderWrapper.cs
- SizeConverter.cs
- DefaultAsyncDataDispatcher.cs
- MethodBuilder.cs
- FileStream.cs
- DataGridViewHitTestInfo.cs
- CustomAttributeBuilder.cs
- SoundPlayerAction.cs
- ProfileInfo.cs
- recordstatescratchpad.cs
- TransformProviderWrapper.cs