**** Merged from MCS ****
[mono-project.git] / mcs / class / Microsoft.Web.Services / Microsoft.Web.Services.Security / SignatureKey.cs
blob18c932ed48658e8325a08ce7e0cfdf9ddb9b3e73
1 //
2 // SignatureKey.cs: Handles WS-Security SignatureKey
3 //
4 // Author:
5 // Sebastien Pouliot (spouliot@motus.com)
6 //
7 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
8 //
9 // Licensed under MIT X11 (see LICENSE) with this specific addition:
11 // “This source code may incorporate intellectual property owned by Microsoft
12 // Corporation. Our provision of this source code does not include any licenses
13 // or any other rights to you under any Microsoft intellectual property. If you
14 // would like a license from Microsoft (e.g. rebrand, redistribute), you need
15 // to contact Microsoft directly.”
18 using System.Security.Cryptography;
19 // temp
20 using System.Security.Cryptography.Xml;
22 namespace Microsoft.Web.Services.Security {
24 public class SignatureKey {
26 private AsymmetricAlgorithm asymKey;
27 private SymmetricAlgorithm symKey;
29 public SignatureKey (AsymmetricAlgorithm key)
31 asymKey = key;
34 public SignatureKey (SymmetricAlgorithm key)
36 symKey = key;
39 public virtual void ComputeSignature (SignedXml signedXml)
41 if (asymKey != null) {
42 signedXml.SigningKey = asymKey;
43 signedXml.ComputeSignature ();
45 else {
46 HMACSHA1 hmac = new HMACSHA1 (symKey.Key);
47 signedXml.ComputeSignature (hmac);