libfreerdp-core: improve premaster secret encryption, but does not pass unit test yet
This commit is contained in:
parent
9ce4ec492a
commit
d19f0d1584
@ -272,12 +272,12 @@ void test_license(void)
|
||||
STREAM* s;
|
||||
|
||||
s = stream_new(0);
|
||||
s->data = server_license_request;
|
||||
s->p = s->data + LICENSE_PREAMBLE_LENGTH;
|
||||
|
||||
memcpy(license->client_random, client_random, sizeof(client_random));
|
||||
memcpy(license->premaster_secret, premaster_secret, sizeof(premaster_secret));
|
||||
|
||||
s->data = server_license_request;
|
||||
s->p = s->data + LICENSE_PREAMBLE_LENGTH;
|
||||
license_read_license_request_packet(license, s);
|
||||
|
||||
printf("\n");
|
||||
@ -302,10 +302,31 @@ void test_license(void)
|
||||
freerdp_hexdump(license->session_key_blob, 48);
|
||||
printf("\n");
|
||||
|
||||
printf("licensing encryption key:\n");
|
||||
freerdp_hexdump(license->licensing_encryption_key, 16);
|
||||
printf("\n");
|
||||
|
||||
printf("mac salt key:\n");
|
||||
freerdp_hexdump(license->mac_salt_key, 16);
|
||||
printf("\n");
|
||||
|
||||
printf("modulus:\n");
|
||||
freerdp_hexdump(license->certificate->cert_info.modulus.data,
|
||||
license->certificate->cert_info.modulus.length);
|
||||
printf("\n");
|
||||
|
||||
printf("exponent:\n");
|
||||
freerdp_hexdump(license->certificate->cert_info.exponent, 4);
|
||||
printf("\n");
|
||||
|
||||
/* the encrypted premaster secret is 256 + 8 bytes long, with 8 bytes of padding */
|
||||
|
||||
printf("encrypted premaster secret:\n");
|
||||
freerdp_hexdump(license->encrypted_pre_master_secret->data,
|
||||
license->encrypted_pre_master_secret->length);
|
||||
printf("\n");
|
||||
|
||||
s->data = server_platform_challenge;
|
||||
s->p = s->data + LICENSE_PREAMBLE_LENGTH;
|
||||
license_read_platform_challenge_packet(license, s);
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ void license_generate_keys(rdpLicense* license)
|
||||
license->encrypted_pre_master_secret->length = RSA_MAX_KEY_LENGTH + 8;
|
||||
license->encrypted_pre_master_secret->data = (uint8*) xzalloc(RSA_MAX_KEY_LENGTH + 8);
|
||||
|
||||
crypto_rsa(RSA_MAX_KEY_LENGTH, license->premaster_secret, license->encrypted_pre_master_secret->data,
|
||||
crypto_rsa(PREMASTER_SECRET_LENGTH, license->premaster_secret, license->encrypted_pre_master_secret->data,
|
||||
license->certificate->cert_info.modulus.length, license->certificate->cert_info.modulus.data,
|
||||
license->certificate->cert_info.exponent);
|
||||
}
|
||||
@ -447,7 +447,7 @@ void license_read_platform_challenge_packet(rdpLicense* license, STREAM* s)
|
||||
/* MACData (16 bytes) */
|
||||
stream_seek(s, 16);
|
||||
|
||||
printf("encrypted platform challenge\n", license->encrypted_platform_challenge->length);
|
||||
printf("encrypted platform challenge\n");
|
||||
freerdp_hexdump(license->encrypted_platform_challenge->data, license->encrypted_platform_challenge->length);
|
||||
|
||||
platform_challenge = (uint8*) xmalloc(license->encrypted_platform_challenge->length);
|
||||
@ -457,7 +457,7 @@ void license_read_platform_challenge_packet(rdpLicense* license, STREAM* s)
|
||||
crypto_rc4(rc4, license->encrypted_platform_challenge->length,
|
||||
license->encrypted_platform_challenge->data, platform_challenge);
|
||||
|
||||
printf("decrypted platform challenge\n", license->encrypted_platform_challenge->length);
|
||||
printf("decrypted platform challenge\n");
|
||||
freerdp_hexdump(platform_challenge, license->encrypted_platform_challenge->length);
|
||||
|
||||
crypto_rc4_free(rc4);
|
||||
|
Loading…
x
Reference in New Issue
Block a user