Commit 7d4d26a5 authored by npzacs's avatar npzacs
Browse files

Add aacs_get_bdj_root_cert_hash() and aacs_get_content_cert_id()

parent b56e1db8
- Add aacs_get_bdj_root_cert_hash().
- Add aacs_get_content_cert_id().
- Verify content certificate signature.
- Fix build with gcrypt < 1.6.0.
......
......@@ -114,6 +114,9 @@ int main (int argc, char **argv)
const uint8_t *pmsn = aacs_get_pmsn(aacs);
const int bec = aacs_get_bus_encryption(aacs);
const uint8_t *binding_id = aacs_get_device_binding_id(aacs);
const uint8_t *bdj_hash = aacs_get_bdj_root_cert_hash(aacs);
const uint8_t *cc_id = aacs_get_content_cert_id(aacs);
printf("Disc ID: %s\n", id ? _hex2str(id, 20) : "???");
printf("VID : %s\n", vid ? _hex2str(vid, 16) : "???");
printf("MKBv : %d\n", aacs_get_mkb_version(aacs));
......@@ -121,7 +124,10 @@ int main (int argc, char **argv)
printf("Bus encryption:\n");
printf(" Device support: %s\n", (bec & AACS_BUS_ENCRYPTION_CAPABLE) ? "yes" : "no");
printf(" Enabled in media: %s\n", (bec & AACS_BUS_ENCRYPTION_ENABLED) ? "yes" : "no");
printf("Device binding ID: %s\n", binding_id ? _hex2str(binding_id, 16) : "???");
printf("Content Certificate ID: %s\n", cc_id ? _hex2str(cc_id, 6) : "???");
printf("BD-J Root Cert hash: %s\n", bdj_hash ? _hex2str(bdj_hash, 20) : "???");
printf("Device binding ID: %s\n", binding_id ? _hex2str(binding_id, 16) : "???");
aacs_close(aacs);
......
......@@ -1179,6 +1179,22 @@ const uint8_t *aacs_get_disc_id(AACS *aacs)
return aacs->disc_id;
}
const uint8_t *aacs_get_content_cert_id(AACS *aacs)
{
if (aacs && aacs->cc) {
return aacs->cc->cc_id;
}
return NULL;
}
const uint8_t *aacs_get_bdj_root_cert_hash(AACS *aacs)
{
if (aacs && aacs->cc) {
return aacs->cc->bdj_root_cert_hash;
}
return NULL;
}
const uint8_t *aacs_get_mk(AACS *aacs)
{
if (!memcmp(aacs->mk, empty_key, 16)) {
......
......@@ -58,6 +58,8 @@ AACS_PUBLIC const uint8_t *aacs_get_disc_id(AACS *aacs);
AACS_PUBLIC const uint8_t *aacs_get_vid(AACS *aacs); /* may fail even if disc can be decrypted */
AACS_PUBLIC const uint8_t *aacs_get_pmsn(AACS *aacs); /* may fail even if disc can be decrypted */
AACS_PUBLIC const uint8_t *aacs_get_mk(AACS *aacs); /* may fail even if disc can be decrypted */
AACS_PUBLIC const uint8_t *aacs_get_content_cert_id(AACS *aacs);
AACS_PUBLIC const uint8_t *aacs_get_bdj_root_cert_hash(AACS *aacs);
/* AACS Online */
AACS_PUBLIC const uint8_t *aacs_get_device_binding_id(AACS *aacs);
......
......@@ -66,6 +66,8 @@ CONTENT_CERT *cc_parse(const void *data, size_t len)
CONTENT_CERT *c = calloc(1, sizeof(CONTENT_CERT));
c->bus_encryption_enabled_flag = p[1] >> 7;
memcpy(c->cc_id, p + 14, 6);
memcpy(c->bdj_root_cert_hash, p + 46, 20);
return c;
}
......
......@@ -29,6 +29,9 @@ typedef struct content_cert CONTENT_CERT;
struct content_cert {
uint8_t bus_encryption_enabled_flag;
uint8_t cc_id[6];
uint8_t bdj_root_cert_hash[20];
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment