| | | 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 CoreWCF.IdentityModel.Tokens; |
| | | 5 | | |
| | | 6 | | namespace CoreWCF.IdentityModel.Protocols.WSTrust |
| | | 7 | | { |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// This class are used in defining Entropy and RequestProofToken element inside the |
| | | 11 | | /// RequestSecurityToken and RequestSecurityTokenResponse. |
| | | 12 | | /// </summary> |
| | | 13 | | public class ProtectedKey |
| | | 14 | | { |
| | | 15 | | byte[] _secret; |
| | | 16 | | EncryptingCredentials _wrappingCredentials; |
| | | 17 | | |
| | | 18 | | /// <summary> |
| | | 19 | | /// Use this constructor if we want to send the key material in clear text. |
| | | 20 | | /// </summary> |
| | | 21 | | /// <param name="secret">The key material that needs to be protected.</param> |
| | 0 | 22 | | public ProtectedKey(byte[] secret) |
| | | 23 | | { |
| | 0 | 24 | | _secret = secret; |
| | 0 | 25 | | } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// Use this constructor if we want to send the key material encrypted. |
| | | 29 | | /// </summary> |
| | | 30 | | /// <param name="secret">The key material that needs to be protected.</param> |
| | | 31 | | /// <param name="wrappingCredentials">The encrypting credentials used to encrypt the key material.</param> |
| | 0 | 32 | | public ProtectedKey(byte[] secret, EncryptingCredentials wrappingCredentials) |
| | | 33 | | { |
| | 0 | 34 | | _secret = secret; |
| | 0 | 35 | | _wrappingCredentials = wrappingCredentials; |
| | 0 | 36 | | } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Gets the key material. |
| | | 40 | | /// </summary> |
| | | 41 | | public byte[] GetKeyBytes() |
| | | 42 | | { |
| | 0 | 43 | | return _secret; |
| | | 44 | | } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Gets the encrypting credentials. Null means that the keys are not encrypted. |
| | | 48 | | /// </summary> |
| | | 49 | | public EncryptingCredentials WrappingCredentials |
| | | 50 | | { |
| | | 51 | | get |
| | | 52 | | { |
| | 0 | 53 | | return _wrappingCredentials; |
| | | 54 | | } |
| | | 55 | | } |
| | | 56 | | } |
| | | 57 | | } |
| | | 58 | | |