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 / 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
- securitycriticaldata.cs
- ModelChangedEventArgsImpl.cs
- AllowedAudienceUriElementCollection.cs
- ISessionStateStore.cs
- EncoderBestFitFallback.cs
- _NegotiateClient.cs
- VirtualizingPanel.cs
- MachineKeySection.cs
- ExpressionSelection.cs
- CacheMode.cs
- StretchValidation.cs
- OrthographicCamera.cs
- ExternalCalls.cs
- Activity.cs
- TargetControlTypeAttribute.cs
- CommandPlan.cs
- DateTimeStorage.cs
- CompilerGeneratedAttribute.cs
- CheckBox.cs
- FunctionCommandText.cs
- UnionCodeGroup.cs
- SqlTriggerAttribute.cs
- Task.cs
- XamlToRtfWriter.cs
- OdbcRowUpdatingEvent.cs
- SafeSecurityHelper.cs
- ProviderException.cs
- GeneralTransform2DTo3D.cs
- ClickablePoint.cs
- DataBinder.cs
- PageBuildProvider.cs
- PropertyBuilder.cs
- DataConnectionHelper.cs
- WorkflowOperationAsyncResult.cs
- FamilyMap.cs
- StructuredType.cs
- WpfMemberInvoker.cs
- VersionedStream.cs
- IMembershipProvider.cs
- SQLInt64.cs
- RedBlackList.cs
- BindingWorker.cs
- RawAppCommandInputReport.cs
- CurrentTimeZone.cs
- ActivityDesignerResources.cs
- X509Extension.cs
- ToolStripComboBox.cs
- ObjectListComponentEditor.cs
- IPHostEntry.cs
- InstanceData.cs
- DataPagerCommandEventArgs.cs
- TargetConverter.cs
- RotateTransform3D.cs
- VSDExceptions.cs
- JournalEntryStack.cs
- ApplicationInfo.cs
- DataGridViewToolTip.cs
- SqlLiftIndependentRowExpressions.cs
- UrlAuthorizationModule.cs
- TextComposition.cs
- IPEndPoint.cs
- XslTransform.cs
- ParameterInfo.cs
- CultureSpecificStringDictionary.cs
- ShaperBuffers.cs
- HyperLink.cs
- Int64Animation.cs
- ResXResourceWriter.cs
- HMACSHA256.cs
- EmptyStringExpandableObjectConverter.cs
- ValidateNames.cs
- MarshalByRefObject.cs
- ServerReliableChannelBinder.cs
- Condition.cs
- IconConverter.cs
- SecurityTokenParametersEnumerable.cs
- InvokePattern.cs
- XmlDocumentFragment.cs
- HostingEnvironmentException.cs
- ControlAdapter.cs
- XamlSerializer.cs
- Point3DAnimationBase.cs
- DaylightTime.cs
- UnsafeNativeMethodsMilCoreApi.cs
- DecoderReplacementFallback.cs
- ScrollChangedEventArgs.cs
- ThreadExceptionEvent.cs
- MenuBindingsEditor.cs
- StandardBindingReliableSessionElement.cs
- MultipartContentParser.cs
- Binding.cs
- NavigationEventArgs.cs
- SspiSecurityTokenProvider.cs
- ColorConvertedBitmap.cs
- TableSectionStyle.cs
- unsafeIndexingFilterStream.cs
- DockPatternIdentifiers.cs
- AnimatedTypeHelpers.cs
- SqlUdtInfo.cs
- GroupQuery.cs