Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / Cryptography / DSASignatureDeformatter.cs / 1305376 / DSASignatureDeformatter.cs
using System.Diagnostics.Contracts; // ==++== // // 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"); Contract.EndContractBlock(); _dsaKey = (DSA) key; } // // public methods // public override void SetKey(AsymmetricAlgorithm key) { if (key == null) throw new ArgumentNullException("key"); Contract.EndContractBlock(); _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 (rgbHash == null) throw new ArgumentNullException("rgbHash"); if (rgbSignature == null) throw new ArgumentNullException("rgbSignature"); Contract.EndContractBlock(); if (_dsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); return _dsaKey.VerifySignature(rgbHash, rgbSignature); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System.Diagnostics.Contracts; // ==++== // // 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"); Contract.EndContractBlock(); _dsaKey = (DSA) key; } // // public methods // public override void SetKey(AsymmetricAlgorithm key) { if (key == null) throw new ArgumentNullException("key"); Contract.EndContractBlock(); _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 (rgbHash == null) throw new ArgumentNullException("rgbHash"); if (rgbSignature == null) throw new ArgumentNullException("rgbSignature"); Contract.EndContractBlock(); if (_dsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); return _dsaKey.VerifySignature(rgbHash, rgbSignature); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CollectionViewGroupInternal.cs
- RuleConditionDialog.Designer.cs
- OdbcErrorCollection.cs
- PasswordTextContainer.cs
- ConfigurationManagerHelper.cs
- XmlExtensionFunction.cs
- WebPartConnectionsEventArgs.cs
- InputReportEventArgs.cs
- StyleSheet.cs
- ReflectionServiceProvider.cs
- GenericTextProperties.cs
- PermissionToken.cs
- PerformanceCounter.cs
- TextDecoration.cs
- WinFormsUtils.cs
- XmlNamespaceDeclarationsAttribute.cs
- Column.cs
- StreamSecurityUpgradeAcceptorBase.cs
- UnrecognizedPolicyAssertionElement.cs
- _LazyAsyncResult.cs
- ColumnResizeAdorner.cs
- FamilyMapCollection.cs
- ModelPropertyImpl.cs
- XmlBindingWorker.cs
- Int64Storage.cs
- MemoryRecordBuffer.cs
- EnvelopedPkcs7.cs
- StatusBar.cs
- DefaultAsyncDataDispatcher.cs
- WaitForChangedResult.cs
- RightsManagementPermission.cs
- CustomAttribute.cs
- AnnotationHelper.cs
- DynamicPropertyReader.cs
- PageTheme.cs
- XmlSerializerAssemblyAttribute.cs
- DBDataPermission.cs
- XmlEnumAttribute.cs
- HttpCachePolicy.cs
- DataSourceView.cs
- TextParagraphView.cs
- WindowHelperService.cs
- ListBox.cs
- FormViewPagerRow.cs
- EnvironmentPermission.cs
- WebPartsSection.cs
- DefaultClaimSet.cs
- ServiceAuthorizationBehavior.cs
- PageWrapper.cs
- DataServiceQueryException.cs
- ManifestResourceInfo.cs
- XmlWriterTraceListener.cs
- ExceptionUtil.cs
- XmlILTrace.cs
- DefaultExpression.cs
- CodeDOMUtility.cs
- BodyWriter.cs
- ProtocolsConfigurationEntry.cs
- _IPv4Address.cs
- DesignTimeVisibleAttribute.cs
- UserPreferenceChangingEventArgs.cs
- NotFiniteNumberException.cs
- DataBoundControlHelper.cs
- PagesSection.cs
- RIPEMD160.cs
- Point3DAnimation.cs
- SBCSCodePageEncoding.cs
- SafeProcessHandle.cs
- AppDomainProtocolHandler.cs
- ImageSourceValueSerializer.cs
- MinMaxParagraphWidth.cs
- WhitespaceRule.cs
- CodeParameterDeclarationExpressionCollection.cs
- CompositeClientFormatter.cs
- KeysConverter.cs
- ClickablePoint.cs
- XmlEncoding.cs
- InfoCardBaseException.cs
- ClaimComparer.cs
- CompiledQuery.cs
- XmlObjectSerializerReadContextComplex.cs
- ComAdminInterfaces.cs
- SmtpFailedRecipientException.cs
- DataGridViewColumnConverter.cs
- OperatingSystem.cs
- ExecutionContext.cs
- filewebresponse.cs
- ScriptResourceInfo.cs
- StrokeIntersection.cs
- SspiHelper.cs
- CheckBoxPopupAdapter.cs
- UpdateRecord.cs
- DynamicHyperLink.cs
- PointLight.cs
- FormViewInsertEventArgs.cs
- ObjectQueryExecutionPlan.cs
- ContentElement.cs
- XPathNodeIterator.cs
- KeyedCollection.cs
- PackageRelationship.cs