| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | |
| | | 6 | | namespace CoreWCF.IdentityModel.Tokens |
| | | 7 | | { |
| | | 8 | | public class SigningCredentials |
| | | 9 | | { |
| | | 10 | | private string _signatureAlgorithm; |
| | | 11 | | private SecurityKeyIdentifier _signingKeyIdentifier; |
| | | 12 | | |
| | | 13 | | public SigningCredentials(SecurityKey signingKey, string signatureAlgorithm, string digestAlgorithm) : |
| | 0 | 14 | | this(signingKey, signatureAlgorithm, digestAlgorithm, null) |
| | 0 | 15 | | { } |
| | | 16 | | |
| | 0 | 17 | | public SigningCredentials(SecurityKey signingKey, string signatureAlgorithm, string digestAlgorithm, SecurityKey |
| | | 18 | | { |
| | 0 | 19 | | if (signingKey == null) |
| | | 20 | | { |
| | 0 | 21 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(signingKey))) |
| | | 22 | | } |
| | | 23 | | |
| | 0 | 24 | | if (signatureAlgorithm == null) |
| | | 25 | | { |
| | 0 | 26 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(signatureAlgo |
| | | 27 | | } |
| | 0 | 28 | | if (digestAlgorithm == null) |
| | | 29 | | { |
| | 0 | 30 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(digestAlgorit |
| | | 31 | | } |
| | 0 | 32 | | SigningKey = signingKey; |
| | 0 | 33 | | _signatureAlgorithm = signatureAlgorithm; |
| | 0 | 34 | | DigestAlgorithm = digestAlgorithm; |
| | 0 | 35 | | _signingKeyIdentifier = signingKeyIdentifier; |
| | 0 | 36 | | } |
| | | 37 | | |
| | 0 | 38 | | public string DigestAlgorithm { get; } |
| | | 39 | | |
| | | 40 | | public string SignatureAlgorithm |
| | | 41 | | { |
| | 0 | 42 | | get { return _signatureAlgorithm; } |
| | | 43 | | } |
| | | 44 | | |
| | 0 | 45 | | public SecurityKey SigningKey { get; } |
| | | 46 | | |
| | | 47 | | public SecurityKeyIdentifier SigningKeyIdentifier |
| | | 48 | | { |
| | 0 | 49 | | get { return _signingKeyIdentifier; } |
| | | 50 | | } |
| | | 51 | | } |
| | | 52 | | } |