Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / clr / src / BCL / System / Security / Cryptography / DSASignatureFormatter.cs / 1 / DSASignatureFormatter.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // DSASignatureFormatter.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class DSASignatureFormatter : AsymmetricSignatureFormatter { DSA _dsaKey; String _oid; // // public constructors // public DSASignatureFormatter() { // The hash algorithm is always SHA1 _oid = CryptoConfig.MapNameToOID("SHA1"); } public DSASignatureFormatter(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 byte[] CreateSignature(byte[] rgbHash) { if (_oid == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingOID")); if (_dsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); if (rgbHash == null) throw new ArgumentNullException("rgbHash"); return _dsaKey.CreateSignature(rgbHash); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // DSASignatureFormatter.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class DSASignatureFormatter : AsymmetricSignatureFormatter { DSA _dsaKey; String _oid; // // public constructors // public DSASignatureFormatter() { // The hash algorithm is always SHA1 _oid = CryptoConfig.MapNameToOID("SHA1"); } public DSASignatureFormatter(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 byte[] CreateSignature(byte[] rgbHash) { if (_oid == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingOID")); if (_dsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); if (rgbHash == null) throw new ArgumentNullException("rgbHash"); return _dsaKey.CreateSignature(rgbHash); } } } // 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
- ExpressionVisitorHelpers.cs
- MembershipSection.cs
- ButtonRenderer.cs
- SafeArrayRankMismatchException.cs
- X509ThumbprintKeyIdentifierClause.cs
- ObjectFullSpanRewriter.cs
- PersistChildrenAttribute.cs
- HitTestWithGeometryDrawingContextWalker.cs
- TreeNodeMouseHoverEvent.cs
- CharAnimationUsingKeyFrames.cs
- JpegBitmapDecoder.cs
- DataExpression.cs
- WsatTransactionInfo.cs
- StringHelper.cs
- StringExpressionSet.cs
- X509InitiatorCertificateServiceElement.cs
- IndexedWhereQueryOperator.cs
- DispatcherHooks.cs
- XmlChildNodes.cs
- SizeIndependentAnimationStorage.cs
- SizeAnimation.cs
- ApplicationActivator.cs
- DataContractAttribute.cs
- ComponentChangingEvent.cs
- VersionedStream.cs
- XmlAtomicValue.cs
- ViewGenResults.cs
- SafeNativeMethods.cs
- BoolLiteral.cs
- RoutedEventHandlerInfo.cs
- ErrorProvider.cs
- ProtectedConfigurationSection.cs
- EntityTypeBase.cs
- HttpValueCollection.cs
- BamlMapTable.cs
- StreamSecurityUpgradeAcceptorAsyncResult.cs
- DataGrid.cs
- CheckBoxField.cs
- HtmlInputControl.cs
- GeneratedCodeAttribute.cs
- altserialization.cs
- DataServiceConfiguration.cs
- SizeConverter.cs
- CachedPathData.cs
- InputReportEventArgs.cs
- TreeViewImageKeyConverter.cs
- Vector3DConverter.cs
- _NegoState.cs
- TagPrefixAttribute.cs
- ListSortDescriptionCollection.cs
- PriorityChain.cs
- CellParaClient.cs
- ExpressionPrefixAttribute.cs
- WebPartConnection.cs
- PseudoWebRequest.cs
- OdbcParameter.cs
- TypeUnloadedException.cs
- MexTcpBindingElement.cs
- DocumentOutline.cs
- NavigatingCancelEventArgs.cs
- ArgumentNullException.cs
- VisualBrush.cs
- CharStorage.cs
- MimeBasePart.cs
- Serializer.cs
- sqlnorm.cs
- IgnoreSection.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- Config.cs
- NavigatingCancelEventArgs.cs
- SocketAddress.cs
- MobileControlBuilder.cs
- WsatRegistrationHeader.cs
- SspiSecurityTokenParameters.cs
- PageParserFilter.cs
- PieceDirectory.cs
- coordinatorscratchpad.cs
- ActivityCodeDomSerializer.cs
- documentsequencetextpointer.cs
- AnnotationComponentChooser.cs
- MarkupExtensionReturnTypeAttribute.cs
- WindowsListViewGroupHelper.cs
- MultipartIdentifier.cs
- WindowInteractionStateTracker.cs
- XmlStringTable.cs
- OrderByQueryOptionExpression.cs
- PersonalizationState.cs
- ObjectQueryExecutionPlan.cs
- DependentList.cs
- ComNativeDescriptor.cs
- QilStrConcatenator.cs
- SqlNodeAnnotation.cs
- EntitySetDataBindingList.cs
- BaseParaClient.cs
- CompModSwitches.cs
- SequentialUshortCollection.cs
- PrintControllerWithStatusDialog.cs
- DBCommandBuilder.cs
- Int16Storage.cs
- FunctionQuery.cs