| | | 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 | | using System.Collections.ObjectModel; |
| | | 6 | | using CoreWCF.IdentityModel; |
| | | 7 | | using CoreWCF.IdentityModel.Tokens; |
| | | 8 | | |
| | | 9 | | namespace CoreWCF.Security.Tokens |
| | | 10 | | { |
| | | 11 | | internal sealed class DerivedKeySecurityTokenStub : SecurityToken |
| | | 12 | | { |
| | | 13 | | private readonly string _id; |
| | | 14 | | private readonly string _derivationAlgorithm; |
| | | 15 | | private readonly string _label; |
| | | 16 | | private readonly int _length; |
| | | 17 | | private readonly byte[] _nonce; |
| | | 18 | | private readonly int _offset; |
| | | 19 | | private readonly int _generation; |
| | | 20 | | |
| | 0 | 21 | | public DerivedKeySecurityTokenStub(int generation, int offset, int length, |
| | 0 | 22 | | string label, byte[] nonce, |
| | 0 | 23 | | SecurityKeyIdentifierClause tokenToDeriveIdentifier, string derivationAlgorithm, string id) |
| | | 24 | | { |
| | 0 | 25 | | _id = id; |
| | 0 | 26 | | _generation = generation; |
| | 0 | 27 | | _offset = offset; |
| | 0 | 28 | | _length = length; |
| | 0 | 29 | | _label = label; |
| | 0 | 30 | | _nonce = nonce; |
| | 0 | 31 | | TokenToDeriveIdentifier = tokenToDeriveIdentifier; |
| | 0 | 32 | | _derivationAlgorithm = derivationAlgorithm; |
| | 0 | 33 | | } |
| | | 34 | | |
| | 0 | 35 | | public override string Id => _id; |
| | | 36 | | |
| | 0 | 37 | | public override DateTime ValidFrom => throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplement |
| | | 38 | | |
| | 0 | 39 | | public override DateTime ValidTo => throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplemented |
| | | 40 | | |
| | 0 | 41 | | public override ReadOnlyCollection<SecurityKey> SecurityKeys => null; |
| | | 42 | | |
| | 0 | 43 | | public SecurityKeyIdentifierClause TokenToDeriveIdentifier { get; } |
| | | 44 | | |
| | | 45 | | public DerivedKeySecurityToken CreateToken(SecurityToken tokenToDerive, int maxKeyLength) |
| | | 46 | | { |
| | 0 | 47 | | DerivedKeySecurityToken result = new DerivedKeySecurityToken(_generation, _offset, _length, |
| | 0 | 48 | | _label, _nonce, tokenToDerive, TokenToDeriveIdentifier, _derivationAlgorithm, Id); |
| | 0 | 49 | | result.InitializeDerivedKey(maxKeyLength); |
| | 0 | 50 | | return result; |
| | | 51 | | } |
| | | 52 | | } |
| | | 53 | | } |