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
- ColorTranslator.cs
- BackStopAuthenticationModule.cs
- InkCanvas.cs
- FieldBuilder.cs
- PropertyRef.cs
- RegisteredArrayDeclaration.cs
- RenderOptions.cs
- KnownTypes.cs
- CollectionChangedEventManager.cs
- Rfc2898DeriveBytes.cs
- OdbcEnvironmentHandle.cs
- Normalizer.cs
- StrongName.cs
- ObjectDataSourceDesigner.cs
- UserControlParser.cs
- LineServicesRun.cs
- XPathNodeInfoAtom.cs
- NonParentingControl.cs
- Pair.cs
- GeometryHitTestResult.cs
- ColumnMapProcessor.cs
- MessagingActivityHelper.cs
- SecurityTokenInclusionMode.cs
- ExpressionLexer.cs
- UpdateProgress.cs
- PageParserFilter.cs
- ItemCheckedEvent.cs
- ListViewItem.cs
- DataRowExtensions.cs
- AssemblyAttributes.cs
- ChildDocumentBlock.cs
- CompositeTypefaceMetrics.cs
- TemplateControlCodeDomTreeGenerator.cs
- WorkflowDesignerColors.cs
- DataRecordObjectView.cs
- TypefaceMetricsCache.cs
- LongSumAggregationOperator.cs
- ContentType.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- DataGridViewCellStyle.cs
- BitmapEffectGroup.cs
- EncodingNLS.cs
- GridViewRowPresenter.cs
- XmlQueryRuntime.cs
- CodeDirectionExpression.cs
- TextEditorCopyPaste.cs
- SelectionRange.cs
- GlobalizationSection.cs
- Content.cs
- DataServiceQueryException.cs
- Compensate.cs
- UIElementPropertyUndoUnit.cs
- VersionedStream.cs
- ResourceWriter.cs
- CurrentTimeZone.cs
- Camera.cs
- CookieParameter.cs
- ProtocolState.cs
- TextClipboardData.cs
- InternalControlCollection.cs
- RegisteredScript.cs
- GeometryValueSerializer.cs
- WorkItem.cs
- XPathDescendantIterator.cs
- OperationCanceledException.cs
- StrongNameKeyPair.cs
- AuthenticatedStream.cs
- Path.cs
- EntityViewContainer.cs
- DropDownList.cs
- OleDbDataReader.cs
- VisualTarget.cs
- ListBoxChrome.cs
- TextElementEditingBehaviorAttribute.cs
- ASCIIEncoding.cs
- Rijndael.cs
- MeshGeometry3D.cs
- DbConnectionClosed.cs
- HttpResponse.cs
- BrowsableAttribute.cs
- SettingsSavedEventArgs.cs
- IxmlLineInfo.cs
- UserControlBuildProvider.cs
- OracleBoolean.cs
- FormsAuthenticationEventArgs.cs
- ConnectionProviderAttribute.cs
- ResumeStoryboard.cs
- AutoGeneratedFieldProperties.cs
- Subtree.cs
- XmlStreamStore.cs
- Set.cs
- WorkflowMessageEventArgs.cs
- CollectionType.cs
- WebPartPersonalization.cs
- CallSiteOps.cs
- ChannelSinkStacks.cs
- ListControl.cs
- BitmapEffect.cs
- RepeatBehavior.cs
- DelegatingChannelListener.cs