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
- TypedRowHandler.cs
- LogFlushAsyncResult.cs
- SessionParameter.cs
- SBCSCodePageEncoding.cs
- BidirectionalDictionary.cs
- DataPointer.cs
- AttachmentService.cs
- CustomLineCap.cs
- MachineKeyConverter.cs
- SafeProcessHandle.cs
- WeakReferenceList.cs
- ExpandableObjectConverter.cs
- CompiledXpathExpr.cs
- HttpHandler.cs
- TableCell.cs
- TextRunProperties.cs
- DbConnectionInternal.cs
- XamlTreeBuilderBamlRecordWriter.cs
- DataServiceCollectionOfT.cs
- XmlObjectSerializerWriteContext.cs
- XmlSchemaSimpleTypeRestriction.cs
- MemberListBinding.cs
- ButtonColumn.cs
- ToggleProviderWrapper.cs
- InstallerTypeAttribute.cs
- TdsParserSafeHandles.cs
- AVElementHelper.cs
- FontStretchConverter.cs
- ZipIOExtraFieldElement.cs
- RowUpdatedEventArgs.cs
- ContextMenuStrip.cs
- XD.cs
- MetadataExchangeBindings.cs
- Page.cs
- WizardPanel.cs
- AutoGeneratedFieldProperties.cs
- XmlSchemaSimpleType.cs
- MetadataCache.cs
- DataGridPageChangedEventArgs.cs
- SqlFlattener.cs
- CriticalFileToken.cs
- FixedBufferAttribute.cs
- FrameworkContextData.cs
- PersonalizationStateInfoCollection.cs
- AnimationClockResource.cs
- ResourceExpressionEditor.cs
- CacheSection.cs
- TextElementEnumerator.cs
- PostBackTrigger.cs
- Point3D.cs
- BitmapInitialize.cs
- IndependentAnimationStorage.cs
- XmlUrlResolver.cs
- PointF.cs
- future.cs
- CookieParameter.cs
- BlurBitmapEffect.cs
- Cell.cs
- BackgroundFormatInfo.cs
- NonSerializedAttribute.cs
- LinkArea.cs
- DoubleSumAggregationOperator.cs
- SchemaElement.cs
- SchemaMapping.cs
- Set.cs
- RowToFieldTransformer.cs
- InteropExecutor.cs
- Marshal.cs
- EnvironmentPermission.cs
- Membership.cs
- TypeConverterHelper.cs
- GestureRecognitionResult.cs
- BuildResultCache.cs
- CachedBitmap.cs
- Converter.cs
- SafeCryptoHandles.cs
- ManualResetEvent.cs
- WebServicesInteroperability.cs
- SoapEnvelopeProcessingElement.cs
- _DomainName.cs
- LinkConverter.cs
- BaseCodeDomTreeGenerator.cs
- ConsoleTraceListener.cs
- XmlSchemaSimpleTypeList.cs
- ObjectDesignerDataSourceView.cs
- TypeToArgumentTypeConverter.cs
- SerializationBinder.cs
- ScriptControl.cs
- IgnoreSectionHandler.cs
- EditorAttribute.cs
- KnownAssemblyEntry.cs
- backend.cs
- ReceiveMessageRecord.cs
- Point4DConverter.cs
- CellConstantDomain.cs
- RuntimeResourceSet.cs
- AppModelKnownContentFactory.cs
- LabelDesigner.cs
- TabItemWrapperAutomationPeer.cs
- TextRangeEditLists.cs