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
- InternalConfigSettingsFactory.cs
- EntityDataSourceWrapperCollection.cs
- LoginUtil.cs
- RoutedPropertyChangedEventArgs.cs
- EntityContainerRelationshipSet.cs
- SQlBooleanStorage.cs
- ImageKeyConverter.cs
- COM2TypeInfoProcessor.cs
- Bind.cs
- DragStartedEventArgs.cs
- TriState.cs
- DependencyPropertyHelper.cs
- cookiecollection.cs
- DesignTimeType.cs
- XmlSchemaExporter.cs
- documentsequencetextview.cs
- Literal.cs
- DataIdProcessor.cs
- XamlUtilities.cs
- ZoneMembershipCondition.cs
- Quaternion.cs
- ToolStripContainerActionList.cs
- RoleManagerSection.cs
- EventToken.cs
- WindowInteractionStateTracker.cs
- BindingOperations.cs
- DrawingContextDrawingContextWalker.cs
- __Filters.cs
- OptionUsage.cs
- ResourceSetExpression.cs
- WebPartDescriptionCollection.cs
- OdbcEnvironment.cs
- UpDownBase.cs
- Splitter.cs
- WindowsTooltip.cs
- TextParagraph.cs
- OpCodes.cs
- XpsDocument.cs
- ResourceCodeDomSerializer.cs
- GZipStream.cs
- ObjectTag.cs
- oledbmetadatacolumnnames.cs
- XPathDocumentNavigator.cs
- CodeArrayCreateExpression.cs
- DefaultValueAttribute.cs
- ToolStripContentPanel.cs
- Trace.cs
- UnsafeNativeMethods.cs
- LineServicesCallbacks.cs
- FrugalMap.cs
- AncestorChangedEventArgs.cs
- EventLogRecord.cs
- MetricEntry.cs
- CapabilitiesUse.cs
- XmlElementAttributes.cs
- GridViewEditEventArgs.cs
- WebBrowserEvent.cs
- Quaternion.cs
- WebPartDescriptionCollection.cs
- ListViewGroup.cs
- DetailsViewDeleteEventArgs.cs
- Misc.cs
- SerializerDescriptor.cs
- PrinterSettings.cs
- DebuggerService.cs
- CheckBoxBaseAdapter.cs
- ObjectRef.cs
- WebPartConnectionsEventArgs.cs
- connectionpool.cs
- Evidence.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- SQLByteStorage.cs
- InheritanceAttribute.cs
- BufferedGraphicsContext.cs
- EmptyReadOnlyDictionaryInternal.cs
- XPathArrayIterator.cs
- MobilePage.cs
- OptimalBreakSession.cs
- StringWriter.cs
- ThicknessAnimationUsingKeyFrames.cs
- AnchorEditor.cs
- LogReservationCollection.cs
- ClassValidator.cs
- CompositeCollection.cs
- Ipv6Element.cs
- BamlBinaryWriter.cs
- FileDialogCustomPlacesCollection.cs
- Processor.cs
- CodeSnippetExpression.cs
- PersonalizableAttribute.cs
- TreeBuilder.cs
- ComplexLine.cs
- ImportCatalogPart.cs
- ProfilePropertyNameValidator.cs
- CryptoHelper.cs
- CacheModeValueSerializer.cs
- Base64Encoder.cs
- TextLineResult.cs
- XmlCharCheckingReader.cs
- ArcSegment.cs