Skip to content

Instantly share code, notes, and snippets.

View apowers313's full-sized avatar

Adam Powers apowers313

View GitHub Profile
@apowers313
apowers313 / gist:5f484fd85da7a885b31c7dceecb7dd13
Created February 28, 2017 06:06
Self-Signed Packed Attestation
======================================================================
Packed Attestation Object (S5.3.4, S7.2)
======================================================================
A3 // map(3)
63 // key(3)
66 6D 74 // "alg"
66 // text(5)
70 61 63 6B 65 64 // "packed"
68 // key(8)
61 75 74 68 44 61 74 61 // "authData"
@apowers313
apowers313 / UAFTLV.js
Last active June 11, 2023 07:06
UAF TLV Decoder Example
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
// Use a lookup table to find the index.
var lookup = new Uint8Array(256);
for (var i = 0; i < chars.length; i++) {
lookup[chars.charCodeAt(i)] = i;
}
// stolen from:
// https://github.com/niklasvh/base64-arraybuffer/blob/master/lib/base64-arraybuffer.js
0xa2, // map(2)
0x01, // integer 1 = param 1
0xA2, // map(2)
0x64, // text(4)
0x74, 0x79, 0x70, 0x65, // "type"
0x64, // text(4)
0x46, 0x49, 0x44, 0x4F, // "FIDO"
0x62, // text(2)
0x69, 0x64, // "id"
0x78, 0x24, // text(36)
0x30, 0x82, 0x01, 0x4B, // sequence(2)
0x30, 0x82, 0x01, 0x03, // sequence(2)
0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, // OID 1.2.840.10045.2.1 = EC Public Key
0x30, 0x81, 0xF7, // sequence(6)
0x02, 0x01, 0x01, // integer 1
0x30, 0x2C, // sequence(2)
0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x01, 0x01, // OID 1.2.840.10045.1.1 = id-prime-Field
0x02, 0x21, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, // integer(256 bit) = prime
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ...
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, // ...