인디노트

How to parse the attestationObject in Node.js 본문

인증기술/보안기술

How to parse the attestationObject in Node.js

인디개발자 2020. 12. 21. 17:47
// this is your attestationObject which is web safe base64 encode string
var attestationObject = "o2NmbXRkbm9uZWdhdHRTdG10oGhhdXRoRGF0YVjE4mQ5WmgO3yl24XjxRqkP9LjqRYP-GsIubALB-5K_CK5FXMrOUa3OAAI1vMYKZIsLJfHwVQMAQABcapsmHtrsLJtfZ7RDcRm0iDgMlc5-CuP2XcNOwDy0uU2mU44ENk-EqtthH7huq8AipYfY0EvmfPRqQI-zI5GlAQIDJiABIVggZplpmQSKsJvg78INyrQUgBo9dv0vaZL6Qp15rOd6wMQiWCAx-ZeQ6T_xTMlY9cG3EWY54wT9Hd6EX7P7Ak-9uwauCA";

// need to convert to base64 encode string
attestationObject = attestationObject.replace(/\-/g, '+').replace(/_/g, '/') + '=='.substring(0, (3*attestationObject.length)%4);

// do a base64 decode
var attCbor = new Buffer(attestationObject, 'base64');

// decode to have CBOR object, using cbor module
const cbor = require("cbor");
var attCborObj = cbor.decodeAllSync(attCbor)[0];
console.log(attCborObj);
반응형

'인증기술 > 보안기술' 카테고리의 다른 글

HMAC (Hash-based Message Authentication Code)  (0) 2021.07.02
Q#에서 퀀텀 난수 생성기 구현  (0) 2021.07.02
SSH Private Key 패스워드 없애기  (0) 2021.05.30
TLS 오버 헤드  (0) 2018.12.19
GSM협회 IoT자료  (0) 2018.10.11
Comments