Skip to content

Commit

Permalink
Added platform id field in decent cert
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghaven committed Jun 19, 2024
1 parent a99fadc commit 41037a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
16 changes: 9 additions & 7 deletions contracts/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,22 @@ library OIDs {
// Decent OIDs
// Root OIDs
bytes32 constant OID_DECENT_EXT_VER =
0x6982f5c89a94ffdfaaab8591c1b5f7c2f782b01e010000000000000000000000;
0x2B0601040183E445010000000000000000000000000000000000000000000000;
bytes32 constant OID_DECENT_PLATFORM_TYPE =
0x6982f5c89a94ffdfaaab8591c1b5f7c2f782b01e020000000000000000000000;
0x2B0601040183E445020000000000000000000000000000000000000000000000;
bytes32 constant OID_DECENT_HASHED_KEYS =
0x6982f5c89a94ffdfaaab8591c1b5f7c2f782b01e040000000000000000000000;
0x2B0601040183E445040000000000000000000000000000000000000000000000;
bytes32 constant OID_DECENT_APP_HASH =
0x6982f5c89a94ffdfaaab8591c1b5f7c2f782b01e050000000000000000000000;
0x2B0601040183E445050000000000000000000000000000000000000000000000;
bytes32 constant OID_DECENT_AUTH_LIST =
0x6982f5c89a94ffdfaaab8591c1b5f7c2f782b01e060000000000000000000000;
0x2B0601040183E445060000000000000000000000000000000000000000000000;
bytes32 constant OID_DECENT_PLATFORM_ID =
0x2B0601040183E445070000000000000000000000000000000000000000000000;
// Platform specific OIDs
bytes32 constant OID_DECENT_STD_REP_DATA =
0x6982f5c89a94ffdfaaab8591c1b5f7c2f782b01e030101000000000000000000;
0x2B0601040183E445030101000000000000000000000000000000000000000000;
bytes32 constant OID_DECENT_ATTESTATION =
0x6982f5c89a94ffdfaaab8591c1b5f7c2f782b01e030102000000000000000000;
0x2B0601040183E445030102000000000000000000000000000000000000000000;
}

library Names {
Expand Down
7 changes: 6 additions & 1 deletion contracts/DecentServerCert.sol
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,13 @@ library DecentServerCert {

// extracting extensions
X509Extension.ExtEntry[] memory extEntries =
new X509Extension.ExtEntry[](5);
new X509Extension.ExtEntry[](6);
extEntries[0].extnID = OIDs.OID_DECENT_EXT_VER;
extEntries[1].extnID = OIDs.OID_DECENT_PLATFORM_TYPE;
extEntries[2].extnID = OIDs.OID_DECENT_HASHED_KEYS;
extEntries[3].extnID = OIDs.OID_DECENT_STD_REP_DATA;
extEntries[4].extnID = OIDs.OID_DECENT_ATTESTATION;
extEntries[5].extnID = OIDs.OID_DECENT_PLATFORM_ID;

X509Extension.extractNeededExtensions(
certDer,
Expand Down Expand Up @@ -316,6 +317,10 @@ library DecentServerCert {
require(false, "Unsupported platform");
}

// Platform ID
require(extEntries[5].isParsed, "Platform ID not found");
cert.platformId = extEntries[5].extnValue.readBytes32(0);

// Decent server public key
extractDecentServerKey(cert, certNodes, certDer, keyRing);

Expand Down

0 comments on commit 41037a1

Please sign in to comment.