< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.BinarySecretKeyIdentifierClause
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/BinarySecretKeyIdentifierClause.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 54
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%110%
.ctor(...)100%110%
.ctor(...)100%110%
GetKeyBytes()100%110%
CreateKey()0%220%
Matches(...)0%440%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/BinarySecretKeyIdentifierClause.cs

#LineLine coverage
 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
 4using CoreWCF.IdentityModel;
 5using CoreWCF.IdentityModel.Tokens;
 6
 7namespace CoreWCF.Security
 8{
 9    public class BinarySecretKeyIdentifierClause : BinaryKeyIdentifierClause
 10    {
 11        private InMemorySymmetricSecurityKey _symmetricKey;
 12
 13        public BinarySecretKeyIdentifierClause(byte[] key)
 014            : this(key, true)
 15        {
 016        }
 17
 18        public BinarySecretKeyIdentifierClause(byte[] key, bool cloneBuffer)
 019            : this(key, cloneBuffer, null, 0)
 20        {
 021        }
 22
 23        public BinarySecretKeyIdentifierClause(byte[] key, bool cloneBuffer, byte[] derivationNonce, int derivationLengt
 024            : base(XD.TrustFeb2005Dictionary.BinarySecretClauseType.Value, key, cloneBuffer, derivationNonce, derivation
 25        {
 026        }
 27
 28        public byte[] GetKeyBytes()
 29        {
 030            return GetBuffer();
 31        }
 32
 33        public override bool CanCreateKey
 34        {
 035            get { return true; }
 36        }
 37
 38        public override SecurityKey CreateKey()
 39        {
 040            if (_symmetricKey == null)
 41            {
 042                _symmetricKey = new InMemorySymmetricSecurityKey(GetBuffer(), false);
 43            }
 44
 045            return _symmetricKey;
 46        }
 47
 48        public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause)
 49        {
 050            BinarySecretKeyIdentifierClause that = keyIdentifierClause as BinarySecretKeyIdentifierClause;
 051            return ReferenceEquals(this, that) || (that != null && that.Matches(GetRawBuffer()));
 52        }
 53    }
 54}