Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / clr / src / BCL / System / Security / Cryptography / DSASignatureDeformatter.cs / 1 / DSASignatureDeformatter.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // DSASignatureDeformatter.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class DSASignatureDeformatter : AsymmetricSignatureDeformatter { DSA _dsaKey; // DSA Key value to do decrypt operation string _oid; // // public constructors // public DSASignatureDeformatter() { // The hash algorithm is always SHA1 _oid = CryptoConfig.MapNameToOID("SHA1"); } public DSASignatureDeformatter(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 bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) { if (_dsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); if (rgbHash == null) throw new ArgumentNullException("rgbHash"); if (rgbSignature == null) throw new ArgumentNullException("rgbSignature"); return _dsaKey.VerifySignature(rgbHash, rgbSignature); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // DSASignatureDeformatter.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class DSASignatureDeformatter : AsymmetricSignatureDeformatter { DSA _dsaKey; // DSA Key value to do decrypt operation string _oid; // // public constructors // public DSASignatureDeformatter() { // The hash algorithm is always SHA1 _oid = CryptoConfig.MapNameToOID("SHA1"); } public DSASignatureDeformatter(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 bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) { if (_dsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); if (rgbHash == null) throw new ArgumentNullException("rgbHash"); if (rgbSignature == null) throw new ArgumentNullException("rgbSignature"); return _dsaKey.VerifySignature(rgbHash, rgbSignature); } } } // 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
- ComUdtElement.cs
- SafeThemeHandle.cs
- ResourceDescriptionAttribute.cs
- DataGridViewDataErrorEventArgs.cs
- DomNameTable.cs
- MouseActionConverter.cs
- Setter.cs
- TemplateControlCodeDomTreeGenerator.cs
- ServiceControllerDesigner.cs
- CorrelationManager.cs
- DiscardableAttribute.cs
- TextRangeAdaptor.cs
- GridEntryCollection.cs
- RichTextBox.cs
- PerformanceCounterCategory.cs
- DataControlFieldCell.cs
- CmsInterop.cs
- LockRecoveryTask.cs
- ContextMenuAutomationPeer.cs
- UserUseLicenseDictionaryLoader.cs
- Stroke2.cs
- ServiceObjectContainer.cs
- RangeBase.cs
- SoapServerProtocol.cs
- ComplexTypeEmitter.cs
- SqlDataSourceCommandParser.cs
- AmbiguousMatchException.cs
- ControlEvent.cs
- OracleTransaction.cs
- UpdatePanelControlTrigger.cs
- DesignBindingConverter.cs
- ConstructorNeedsTagAttribute.cs
- HighlightComponent.cs
- Panel.cs
- HyperLinkField.cs
- NumberSubstitution.cs
- FixedSOMPageElement.cs
- AnnotationAdorner.cs
- DataSourceSelectArguments.cs
- FilterQuery.cs
- ScriptControl.cs
- EntityType.cs
- ListComponentEditorPage.cs
- TextServicesProperty.cs
- InputLanguageManager.cs
- BindingExpression.cs
- XmlnsCache.cs
- ConnectionStringEditor.cs
- Point.cs
- FormattedTextSymbols.cs
- SwitchLevelAttribute.cs
- JsonByteArrayDataContract.cs
- NativeMethods.cs
- CompilerCollection.cs
- CapabilitiesAssignment.cs
- ExtensionQuery.cs
- Win32.cs
- CollectionChangedEventManager.cs
- ParameterToken.cs
- InteropAutomationProvider.cs
- ContainerControlDesigner.cs
- SqlClientWrapperSmiStream.cs
- RequestChannelBinder.cs
- StringUtil.cs
- EntityDataSourceView.cs
- ConstraintEnumerator.cs
- CollectionChangeEventArgs.cs
- TrackBarDesigner.cs
- XmlSchemaSimpleContent.cs
- Condition.cs
- LabelTarget.cs
- ModifierKeysValueSerializer.cs
- CqlBlock.cs
- ArgumentOutOfRangeException.cs
- RsaElement.cs
- COAUTHINFO.cs
- HtmlLinkAdapter.cs
- AlternationConverter.cs
- DispatcherObject.cs
- safemediahandle.cs
- PagedControl.cs
- DataGrid.cs
- ContentElement.cs
- PropertyToken.cs
- XmlUnspecifiedAttribute.cs
- DataMemberFieldEditor.cs
- FlowDocumentView.cs
- ArcSegment.cs
- ObjectQuery_EntitySqlExtensions.cs
- FormClosedEvent.cs
- ClientTarget.cs
- GridViewCellAutomationPeer.cs
- LinkedResourceCollection.cs
- HealthMonitoringSection.cs
- Privilege.cs
- BamlTreeNode.cs
- DirtyTextRange.cs
- IListConverters.cs
- OdbcConnectionFactory.cs
- StorageMappingFragment.cs