Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- TextUtf8RawTextWriter.cs
- GradientSpreadMethodValidation.cs
- DiscoveryDocument.cs
- SafeMemoryMappedViewHandle.cs
- PropagatorResult.cs
- PackageRelationship.cs
- HttpRequestWrapper.cs
- WindowsListView.cs
- CodeExporter.cs
- RadioButton.cs
- AssemblyAttributesGoHere.cs
- Condition.cs
- ClientTargetSection.cs
- EntityTypeBase.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- TextMetrics.cs
- DesignerActionItem.cs
- HttpHeaderCollection.cs
- GACMembershipCondition.cs
- ServicePointManager.cs
- RC2CryptoServiceProvider.cs
- ListMarkerLine.cs
- DBConcurrencyException.cs
- DispatcherHooks.cs
- AppDomain.cs
- Stacktrace.cs
- EmptyEnumerator.cs
- ControlValuePropertyAttribute.cs
- FileLoadException.cs
- SamlAuthenticationStatement.cs
- FolderBrowserDialog.cs
- ConcurrentQueue.cs
- ObjectNavigationPropertyMapping.cs
- DispatcherOperation.cs
- UnmanagedHandle.cs
- VarRefManager.cs
- ProviderUtil.cs
- RoutedEventArgs.cs
- DataSourceUtil.cs
- externdll.cs
- RegexNode.cs
- CommandLibraryHelper.cs
- SafeMILHandle.cs
- InvokePattern.cs
- AccessDataSourceView.cs
- EncodingTable.cs
- ExpandSegmentCollection.cs
- GeneralTransformGroup.cs
- UnknownBitmapDecoder.cs
- StringValueConverter.cs
- PcmConverter.cs
- SafeThemeHandle.cs
- SortKey.cs
- DataTransferEventArgs.cs
- ReadOnlyDataSourceView.cs
- LayoutSettings.cs
- GridErrorDlg.cs
- FontStretch.cs
- RegisterInfo.cs
- ValueConversionAttribute.cs
- SmtpException.cs
- SimpleWebHandlerParser.cs
- DrawingServices.cs
- BoolExpression.cs
- BinaryParser.cs
- ParameterCollection.cs
- SystemMulticastIPAddressInformation.cs
- ReadOnlyObservableCollection.cs
- SiteMapNodeItemEventArgs.cs
- CodeDOMUtility.cs
- MetabaseServerConfig.cs
- SoapTransportImporter.cs
- RSAOAEPKeyExchangeDeformatter.cs
- DbMetaDataFactory.cs
- DispatcherExceptionEventArgs.cs
- RequestChannel.cs
- ClrProviderManifest.cs
- PrimitiveSchema.cs
- ParseNumbers.cs
- FaultPropagationQuery.cs
- SqlReorderer.cs
- NullRuntimeConfig.cs
- BatchWriter.cs
- LinkedResourceCollection.cs
- QueryContinueDragEventArgs.cs
- SurrogateSelector.cs
- MemberInfoSerializationHolder.cs
- Selection.cs
- Byte.cs
- PersianCalendar.cs
- BasicExpandProvider.cs
- MemberDomainMap.cs
- TextBox.cs
- DispatcherProcessingDisabled.cs
- DataGridViewCellEventArgs.cs
- FunctionMappingTranslator.cs
- ActivityUtilities.cs
- StaticFileHandler.cs
- TraceContextEventArgs.cs
- PackagePartCollection.cs