File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
tests/unit/Yubico/YubiKey/Fido2 Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 16
16
using System . Collections . Generic ;
17
17
using System . Formats . Cbor ;
18
18
using System . Globalization ;
19
- using System . Security . Cryptography ;
20
19
using System . Security . Cryptography . X509Certificates ;
21
20
using Yubico . YubiKey . Cryptography ;
22
21
using Yubico . YubiKey . Fido2 . Cbor ;
@@ -167,6 +166,12 @@ public class MakeCredentialData
167
166
/// </summary>
168
167
public ReadOnlyMemory < byte > ? LargeBlobKey { get ; private set ; }
169
168
169
+
170
+ /// <summary>
171
+ /// This returns the raw CBOR encoded credential data from the YubiKey, as returned by the MakeCredential operation.
172
+ /// </summary>
173
+ public ReadOnlyMemory < byte > RawData { get ; }
174
+
170
175
// The default constructor explicitly defined. We don't want it to be
171
176
// used.
172
177
private MakeCredentialData ( )
@@ -193,10 +198,11 @@ private MakeCredentialData()
193
198
/// </exception>
194
199
public MakeCredentialData ( ReadOnlyMemory < byte > cborEncoding )
195
200
{
201
+ RawData = cborEncoding ;
202
+ var map = new CborMap < int > ( RawData ) ;
203
+
196
204
try
197
205
{
198
- var map = new CborMap < int > ( cborEncoding ) ;
199
-
200
206
Format = map . ReadTextString ( KeyFormat ) ;
201
207
AuthenticatorData = new AuthenticatorData ( map . ReadByteString ( KeyAuthData ) ) ;
202
208
if ( ! ( AuthenticatorData . CredentialPublicKey is CoseEcPublicKey )
Original file line number Diff line number Diff line change @@ -18,6 +18,15 @@ namespace Yubico.YubiKey.Fido2
18
18
{
19
19
public class CredentialDataTests
20
20
{
21
+ [ Fact ]
22
+ public void RawCredentialData_Is_Set ( )
23
+ {
24
+ byte [ ] encoding = GetSampleEncoding ( ) ;
25
+ var cData = new MakeCredentialData ( encoding ) ;
26
+ Assert . Equal ( encoding , cData . RawData ) ;
27
+ }
28
+
29
+
21
30
[ Fact ]
22
31
public void Decode_Format_Correct ( )
23
32
{
You can’t perform that action at this time.
0 commit comments