From ad9d9c18b879147f8cb7756c2372398eec918707 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 5 Feb 2005 20:25:10 +0000 Subject: [PATCH] Add and load our private key. --- mcs.c | 34 +++++++++++++++++++++++++++++++++- secure.c | 2 ++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/mcs.c b/mcs.c index 7888d8b..6e13770 100644 --- a/mcs.c +++ b/mcs.c @@ -19,10 +19,12 @@ */ #include "rdesktop.h" +#include uint16 g_mcs_userid; extern VCHANNEL g_channels[]; extern unsigned int g_num_channels; +extern RSA *privkey; /* Parse an ASN.1 BER header */ static BOOL @@ -277,7 +279,29 @@ unsigned char server_cert[] = { 0x15, 0x3c, 0xdc, 0x09, 0x4c, 0x36, 0x9a, 0x2b, 0x5e, 0xe0, 0xe6, 0x07, 0x79, 0xfd, 0xcd, 0x1d, 0x06, 0x63, 0xfa, 0xb4, 0x2c, 0xcc, 0x00, 0x25, 0x43, 0x71, 0x65, 0xff, 0xf7 }; - +unsigned char private_key[] = { + 0x30, 0x82, 0x01, 0x3a, 0x02, 0x01, 0x00, 0x02, 0x41, 0x00, 0xb6, 0x88, 0xff, 0x4a, 0x6d, 0x44, + 0x59, 0x6c, 0x3a, 0xe8, 0x5b, 0x53, 0x72, 0x2e, 0x0a, 0x3f, 0x0b, 0xbf, 0x33, 0x87, 0x25, 0x30, + 0xeb, 0x82, 0xf7, 0xd4, 0x98, 0xf1, 0x60, 0xee, 0x6e, 0x99, 0xdd, 0x6f, 0x07, 0xd9, 0xc0, 0xa1, + 0x6c, 0x1c, 0x50, 0xd7, 0xc1, 0x18, 0xe1, 0x5e, 0x70, 0x89, 0x3e, 0x6a, 0x98, 0x2c, 0x8b, 0xef, + 0x76, 0x6d, 0x9b, 0x70, 0xb8, 0xd7, 0x41, 0x25, 0xa1, 0x01, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, + 0x40, 0x1f, 0xf8, 0x02, 0x6e, 0x30, 0x90, 0xe5,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0xbc, + 0x8e, 0xd1, 0x74, 0x31, 0xb0, 0x8f, 0x87, 0x69, 0x2c, 0x22, 0x25, 0x3d, 0x02, 0x20, 0x24, 0x9e, + 0xf6, 0x03, 0x5f, 0x7e, 0x2d, 0xc7, 0x8c, 0x88, 0xf7, 0x43, 0x14, 0xb7, 0x75, 0x72, 0x1e, 0x16, + 0xae, 0x43, 0x71, 0x97, 0xcc, 0xc2, 0x0c, 0xde, 0x63, 0x35, 0x87, 0x50, 0xbf, 0xad +}; + void mcs_send_connect_response() { @@ -368,6 +392,14 @@ mcs_send_connect_response() s_mark_end(s); iso_send(s); + // this is a good time to load our private key :-) + { + unsigned char *buf = (unsigned char *)malloc(1024); + unsigned char *ptr = buf; + memcpy(buf, private_key, sizeof(private_key)); + privkey = d2i_RSAPrivateKey(NULL, &ptr, sizeof(private_key)); + free(buf); + } } /* Send an EDrq message (ASN.1 PER) */ diff --git a/secure.c b/secure.c index f32a081..10fc916 100644 --- a/secure.c +++ b/secure.c @@ -51,6 +51,8 @@ static uint8 sec_decrypt_update_key[16]; static uint8 sec_encrypt_update_key[16]; static uint8 sec_crypted_random[SEC_MODULUS_SIZE]; +RSA *privkey; + uint16 g_server_rdp_version = 0; /* -- 2.39.5