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
- AuthorizationSection.cs
- SqlDataSource.cs
- ContextDataSource.cs
- AssemblyBuilder.cs
- entityreference_tresulttype.cs
- HttpServerChannel.cs
- XmlDataLoader.cs
- ArglessEventHandlerProxy.cs
- ActivityDesignerHighlighter.cs
- BindingSource.cs
- DrawItemEvent.cs
- SettingsPropertyIsReadOnlyException.cs
- ExpressionDumper.cs
- StreamGeometryContext.cs
- Win32PrintDialog.cs
- RankException.cs
- SystemIPGlobalProperties.cs
- KeyedPriorityQueue.cs
- SocketSettings.cs
- QueryExtender.cs
- HtmlTableCell.cs
- TagPrefixCollection.cs
- ListViewDeleteEventArgs.cs
- ScriptHandlerFactory.cs
- SurrogateDataContract.cs
- SoundPlayer.cs
- Literal.cs
- ISAPIRuntime.cs
- HtmlSelect.cs
- OutputScopeManager.cs
- XmlNodeReader.cs
- StoreAnnotationsMap.cs
- OrderingInfo.cs
- WebPartTransformerAttribute.cs
- EncoderBestFitFallback.cs
- ReferencedAssembly.cs
- CodeIterationStatement.cs
- FormsAuthenticationCredentials.cs
- DbProviderServices.cs
- InstanceDataCollection.cs
- DoubleAnimationUsingKeyFrames.cs
- NativeMethods.cs
- DesignRelationCollection.cs
- Rotation3D.cs
- ProtocolsInstallComponent.cs
- PropertyEmitterBase.cs
- HostExecutionContextManager.cs
- TextEndOfSegment.cs
- Brush.cs
- DataGridRow.cs
- ContentPresenter.cs
- JsonDeserializer.cs
- DebugTracing.cs
- ErrorEventArgs.cs
- TextEncodedRawTextWriter.cs
- ETagAttribute.cs
- HttpFormatExtensions.cs
- SoapInteropTypes.cs
- UpdatePanelTriggerCollection.cs
- TemplatedAdorner.cs
- XsltFunctions.cs
- PerformanceCounterNameAttribute.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- EntityDataSourceColumn.cs
- TextContainerHelper.cs
- LocalizableAttribute.cs
- ToolStripOverflow.cs
- DesignerWidgets.cs
- QueryHandler.cs
- CodePageUtils.cs
- SessionPageStatePersister.cs
- VirtualDirectoryMapping.cs
- SmtpException.cs
- XmlValidatingReader.cs
- HttpHandlerAction.cs
- MailWebEventProvider.cs
- FilteredAttributeCollection.cs
- TreeNodeStyleCollectionEditor.cs
- BackEase.cs
- TransformerTypeCollection.cs
- WindowsSysHeader.cs
- DataRelationPropertyDescriptor.cs
- DataList.cs
- ControlCachePolicy.cs
- FormsIdentity.cs
- Subset.cs
- FileAuthorizationModule.cs
- InputGestureCollection.cs
- SymmetricCryptoHandle.cs
- EmptyEnumerable.cs
- Rect.cs
- XPathNodeList.cs
- RegistrationServices.cs
- PointCollectionConverter.cs
- CodeMemberEvent.cs
- FontSizeConverter.cs
- SecurityPolicyVersion.cs
- FormatSettings.cs
- DrawingVisual.cs
- PLINQETWProvider.cs