Skip to content

Commit df39e1f

Browse files
iamcarbonabergs
authored andcommitted
Add AsnHelper.GetBlob
1 parent 155117e commit df39e1f

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Test/Extensions/AsnHelper.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Formats.Asn1;
2+
3+
namespace fido2_net_lib
4+
{
5+
public static class AsnHelper
6+
{
7+
public static byte[] GetBlob(byte[] input)
8+
{
9+
var writer = new AsnWriter(AsnEncodingRules.BER);
10+
11+
writer.WriteOctetString(input);
12+
13+
return writer.Encode();
14+
}
15+
}
16+
}

Test/Fido2Tests.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using System.Text;
1010
using System.Text.Json;
1111
using System.Threading.Tasks;
12-
using Asn1;
1312
using Fido2NetLib;
1413
using Fido2NetLib.Objects;
1514
using Microsoft.Extensions.Caching.Distributed;
@@ -21,15 +20,13 @@
2120

2221
namespace fido2_net_lib.Test
2322
{
24-
2523
// todo: Create tests and name Facts and json files better.
2624
public class Fido2Tests
2725
{
2826
private static readonly IMetadataService _metadataService;
2927
private static readonly Fido2Configuration _config;
3028
public static readonly List<(COSE.KeyType, COSE.Algorithm, COSE.EllipticCurve)> _validCOSEParameters;
3129

32-
3330
static Fido2Tests()
3431
{
3532
var services = new ServiceCollection();
@@ -180,7 +177,7 @@ public Attestation()
180177

181178
_attestationObject = CBORObject.NewMap();
182179

183-
_asnEncodedAaguid = AsnElt.MakeBlob(AttestedCredentialData.AaGuidToBigEndian(_aaguid)).Encode();
180+
_asnEncodedAaguid = AsnHelper.GetBlob(AttestedCredentialData.AaGuidToBigEndian(_aaguid));
184181

185182
idFidoGenCeAaguidExt = new X509Extension(oidIdFidoGenCeAaguid, _asnEncodedAaguid, false);
186183
}

0 commit comments

Comments
 (0)