Decoding rawattestationData and rawauthenticatorData in Swift

Hi, I tried verifying the rawattestationData and rawAuthenticatorData using third party libraries, but am not able to decode information in both rawAttestationData and rawAuthenticatorData, for ex, in rawAttestationObject, always authData decoding is returning nil. For ex, this string representation of rawattestationdata : a363666d74646e6f6e656761747453746d74a06861757468446174615898d3a03fad282d25bFB82046633c2ae488dbf8e554c515bfe205512879f29c30c25d00000000000000000000000000000000000000000014f8f898d67027d0552f7fd2524e4ffec6debdede9a5010203262001215820fd8a8445e56a6888027b814c5ef51b9ad323d24bFB8725704fe2cdef76b87bbf2258202452a529b55374d20b26a3753167083f7ebc7404db731210f70fab1db757b7d4 returns { "fmt": "none", "attStmt": {}, "authData": h'd3a03fad282d25bFB82046633c2ae488dbf8e554c515bfe205512879f29c30c25d00000000000000000000000000000000000000000014f8f898d67027d0552f7fd2524e4ffec6debdede9a5010203262001215820fd8a8445e56a6888027b814c5ef51b9ad323d24bFB8725704fe2cdef76b87bbf2258202452a529b55374d20b26a3753167083f7ebc7404db731210f70fab1db757b7d4', } in CBOR playground but whenever i try with any third party lib for decoding authData, it returns me nil. and am not able to decode authdata in any CBOR playground online as well, Is there a recommendation or example implementation in swift for decoding cbor rawattestationData and rawauthenticatorData for verification?

Answered by Systems Engineer in 746293022

You generally shouldn't need to decode this in your app; authentication information should be decoded and verified on your server. That said...

authData is not a CBOR blob. It's a byte-packed format that's defined here and needs a bespoke decoder.

Accepted Answer

You generally shouldn't need to decode this in your app; authentication information should be decoded and verified on your server. That said...

authData is not a CBOR blob. It's a byte-packed format that's defined here and needs a bespoke decoder.

Decoding rawattestationData and rawauthenticatorData in Swift
 
 
Q