Exemple #1
0
void license_read_license_request_packet(rdpLicense* license, STREAM* s)
{
	/* ServerRandom (32 bytes) */
	stream_read(s, license->server_random, 32);

	/* ProductInfo */
	license_read_product_info(s, license->product_info);

	/* KeyExchangeList */
	license_read_binary_blob(s, license->key_exchange_list);

	/* ServerCertificate */
	license_read_binary_blob(s, license->server_certificate);

	/* ScopeList */
	license_read_scope_list(s, license->scope_list);

	/* Parse Server Certificate */
	certificate_read_server_certificate(license->certificate,
			license->server_certificate->data, license->server_certificate->length);

	license_generate_keys(license);
	license_generate_hwid(license);
	license_encrypt_premaster_secret(license);
}
Exemple #2
0
BOOL license_read_license_request_packet(rdpLicense* license, STREAM* s)
{
	/* ServerRandom (32 bytes) */
	if(stream_get_left(s) < 32)
		return FALSE;
	stream_read(s, license->server_random, 32);

	/* ProductInfo */
	if (!license_read_product_info(s, license->product_info))
		return FALSE;

	/* KeyExchangeList */
	if (!license_read_binary_blob(s, license->key_exchange_list))
		return FALSE;

	/* ServerCertificate */
	if (!license_read_binary_blob(s, license->server_certificate))
		return FALSE;

	/* ScopeList */
	if (!license_read_scope_list(s, license->scope_list))
		return FALSE;

	/* Parse Server Certificate */
	if (!certificate_read_server_certificate(license->certificate,
			license->server_certificate->data, license->server_certificate->length))
		return FALSE;

	license_generate_keys(license);
	license_generate_hwid(license);
	license_encrypt_premaster_secret(license);
	return TRUE;
}
Exemple #3
0
void test_license_generate_keys(void)
{
	STREAM _s, *s;

	s = &_s;
	memcpy(license->client_random, client_random, sizeof(client_random));
	memcpy(license->server_random, test_server_random, sizeof(test_server_random));
	memcpy(license->premaster_secret, premaster_secret, sizeof(premaster_secret));
	memcpy(license->certificate->cert_info.exponent, test_exponent, sizeof(test_exponent));
	memcpy(license->certificate->cert_info.modulus.data, test_modulus, sizeof(test_modulus));
	license->certificate->cert_info.modulus.length = sizeof(test_modulus);

	license_generate_keys(license);
	license_encrypt_premaster_secret(license);

	s->data = license->master_secret;
	s->p = s->data + sizeof(test_master_secret);
	ASSERT_STREAM(s, test_master_secret, sizeof(test_master_secret));

	s->data = license->session_key_blob;
	s->p = s->data + sizeof(test_session_key_blob);
	ASSERT_STREAM(s, test_session_key_blob, sizeof(test_session_key_blob));

	s->data = license->mac_salt_key;
	s->p = s->data + sizeof(test_mac_salt_key);
	ASSERT_STREAM(s, test_mac_salt_key, sizeof(test_mac_salt_key));

	s->data = license->licensing_encryption_key;
	s->p = s->data + sizeof(test_licensing_encryption_key);
	ASSERT_STREAM(s, test_licensing_encryption_key, sizeof(test_licensing_encryption_key));

	s->data = license->encrypted_premaster_secret->data;
	s->p = s->data + sizeof(test_encrypted_premaster_secret);
	ASSERT_STREAM(s, test_encrypted_premaster_secret, sizeof(test_encrypted_premaster_secret));
}
Exemple #4
0
BOOL license_read_license_request_packet(rdpLicense* license, wStream* s)
{
	/* ServerRandom (32 bytes) */
	if (Stream_GetRemainingLength(s) < 32)
		return FALSE;

	Stream_Read(s, license->ServerRandom, 32);

	/* ProductInfo */
	if (!license_read_product_info(s, license->ProductInfo))
		return FALSE;

	/* KeyExchangeList */
	if (!license_read_binary_blob(s, license->KeyExchangeList))
		return FALSE;

	/* ServerCertificate */
	if (!license_read_binary_blob(s, license->ServerCertificate))
		return FALSE;

	/* ScopeList */
	if (!license_read_scope_list(s, license->ScopeList))
		return FALSE;

	/* Parse Server Certificate */
	if (!certificate_read_server_certificate(license->certificate,
			license->ServerCertificate->data, license->ServerCertificate->length))
		return FALSE;

	license_generate_keys(license);
	license_generate_hwid(license);
	license_encrypt_premaster_secret(license);

#ifdef WITH_DEBUG_LICENSE
	fprintf(stderr, "ServerRandom:\n");
	winpr_HexDump(license->ServerRandom, 32);
	fprintf(stderr, "\n");

	license_print_product_info(license->ProductInfo);
	fprintf(stderr, "\n");

	license_print_scope_list(license->ScopeList);
	fprintf(stderr, "\n");
#endif

	return TRUE;
}