Делаем начальный загрузчик с криптографической защитой для Synergy на базе Azure RTOS18.03.2024 09:15
#include "S7V30.h"
// Не менять формат этого файла !!!
const unsigned char AESKey[AESKey_SIZE] __attribute__ ((aligned (4)))=
{
0x3B,0x77,0xFF,0x09,0x48,0x1B,0x67,0x6F,0xAA,0xB4,0x6B,0xE6,0x39,0x01,0xDD,0x5A,
0x8C,0x24,0xCB,0x92,0x43,0x0C,0xF8,0x21,0x08,0x9F,0xF9,0x48,0xF9,0xBC,0x55,0x28
};
const unsigned char AES_init_vector[AES_init_vector_SIZE] __attribute__ ((aligned (4)))=
{
0xE7,0x94,0x1B,0x8F,0x4C,0xBE,0x9B,0x46,0x58,0x68,0x1D,0xF5,0x00,0x00,0x00,0x01
};
const unsigned char AES_aad[AES_aad_SIZE] __attribute__ ((aligned (4)))=
{
0x8F,0x7C,0xBC,0xF1,0x03,0xAF,0x55,0xA6
};
const unsigned char RSA_public_key[RSA_public_key_SIZE] __attribute__ ((aligned (4)))= // DER encoded RSA public key
{
0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xD7,0xCA,0x28,0x43,0x89,0xB3,0x14,
0x86,0x6C,0x12,0x9E,0x97,0xF8,0x04,0x75,0x73,0x06,0x59,0x42,0x28,0xEE,0x60,0x46,
0xB8,0xF4,0xFF,0x10,0x65,0xFE,0x63,0x46,0x64,0xDC,0x4F,0x6A,0x2F,0x1F,0xEB,0x0D,
0x46,0x5E,0x37,0x9C,0x32,0xFC,0x0A,0xAB,0x2B,0x4C,0x6C,0x44,0x6B,0x7D,0xFA,0x3A,
0x9C,0x28,0x3B,0xB4,0xC4,0xA5,0xD9,0x50,0xCE,0x17,0xE9,0x24,0x66,0xB4,0x83,0x14,
0xF5,0xA3,0xB4,0xE1,0x07,0xAB,0x17,0xBD,0xDE,0x1F,0x64,0x04,0x7B,0x0B,0x83,0x72,
0x04,0x81,0xD7,0xFF,0x9F,0xEF,0x39,0x8B,0x21,0x6A,0x58,0xBA,0x7B,0x37,0x2A,0x3E,
0x55,0x40,0x33,0x33,0x76,0x93,0xA3,0x02,0xCA,0x29,0x6C,0x70,0x3A,0x77,0x13,0x48,
0xAF,0x4A,0xB5,0x20,0x53,0xE5,0x86,0x4A,0x95,0x5D,0xAC,0x96,0xDF,0x73,0x8A,0x40,
0x0F,0x99,0x07,0xD8,0x46,0x4E,0xB4,0x08,0x0F,0x41,0x54,0x57,0x1A,0x41,0x0B,0x0A,
0x9C,0x06,0xBF,0x0F,0x38,0xF7,0x50,0x11,0x8F,0xD1,0xB1,0x7F,0x8E,0xDB,0xD2,0xF7,
0x52,0xE7,0xC3,0xB9,0x50,0x58,0x83,0x89,0x35,0x4C,0xE5,0xBC,0xF0,0x46,0x0F,0xF3,
0xAC,0xDA,0x01,0x97,0x14,0xF3,0xD3,0xD4,0x98,0x8D,0x9C,0x85,0x03,0x68,0xFF,0x00,
0x2E,0xD9,0x5D,0xE0,0xA7,0x3C,0x38,0x49,0x81,0x31,0xB8,0x89,0x27,0x2D,0x95,0x17,
0x46,0x74,0x19,0x9D,0x8D,0x70,0x57,0xB6,0x18,0x0D,0x3B,0xF3,0xFF,0x4B,0xD3,0x2B,
0x74,0x71,0x52,0x03,0xD0,0x7A,0x86,0xE3,0x01,0x7D,0x29,0x21,0x75,0x7B,0x8B,0x6E,
0x77,0x89,0x3A,0xC8,0xD8,0x91,0xF3,0xE4,0xBD,0x02,0x03,0x01,0x00,0x01
};
const unsigned char RSA_private_key[RSA_private_key_SIZE] __attribute__ ((aligned (4)))= // DER encoded RSA private key
{
0x30,0x82,0x04,0xA4,0x02,0x01,0x00,0x02,0x82,0x01,0x01,0x00,0xD7,0xCA,0x28,0x43,
0x89,0xB3,0x14,0x86,0x6C,0x12,0x9E,0x97,0xF8,0x04,0x75,0x73,0x06,0x59,0x42,0x28,
0xEE,0x60,0x46,0xB8,0xF4,0xFF,0x10,0x65,0xFE,0x63,0x46,0x64,0xDC,0x4F,0x6A,0x2F,
0x1F,0xEB,0x0D,0x46,0x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65,0xD0,
0x18,0x6C,0xBA,0xA3,0x24,0x09,0x11,0xD1,0x95,0x22,0x27,0x55,0x49,0x00,0x5D,0x84,
0x0A,0xE7,0x93,0xC3,0x45,0x05,0x3E,0x3D,0x5D,0xAE,0x4C,0x43,0xF8,0x63,0x57,0xA8,
0xAD,0x2F,0x6A,0x65,0xAA,0x68,0x5F,0x9D
};
const unsigned char RSA_priv_exp_modul[RSA_priv_exp_modul_SIZE] __attribute__ ((aligned (4)))=
{
0x1E,0x1C,0x0A,0x97,0x35,0xE9,0x03,0x75,0xA8,0x31,0xC6,0xE8,0x4C,0x86,0x8E,0xBE,
0xD0,0x85,0x76,0xDA,0x50,0x3C,0xA5,0xD1,0x9B,0xF9,0xD5,0x17,0x6E,0x31,0xFA,0xFA,
0x0A,0xD5,0x97,0xEA,0xE0,0x68,0xC3,0x4E,0xEC,0xC9,0x94,0xA5,0x76,0x8E,0xA4,0x88,
0xA3,0x9E,0xBD,0xC3,0x43,0xEE,0x3C,0xEC,0x5A,0x1E,0xCE,0x9F,0xDB,0xC6,0x61,0x64,
0x88,0x68,0x93,0x18,0x33,0x9A,0xD0,0xBB,0x5F,0xAE,0xD6,0xF1,0x63,0x79,0xAA,0x18,
0x0A,0xC8,0x41,0x69,0xCB,0xD6,0xF8,0xFB,0x51,0x04,0xCB,0x19,0xCD,0x5E,0xF9,0x9F,
0x5D,0x7F,0xE8,0xF1,0x55,0x66,0xB3,0x10,0xE1,0x26,0xE3,0xC8,0xE9,0x5B,0xC7,0x01,
0x5F,0x5B,0x4E,0xA3,0x91,0xC6,0xE2,0x8E,0xF6,0xFD,0x23,0xF8,0x20,0xE0,0x26,0x9A,
0xC4,0x2F,0x27,0xE5,0xC8,0x79,0x44,0x00,0x25,0xAE,0x2B,0x2D,0x72,0x53,0x72,0x0E,
0xFE,0x33,0xC1,0x4C,0xE8,0x12,0x92,0x50,0xFA,0xE9,0x5B,0x78,0xDD,0x14,0xCB,0xC1,
0xDD,0x37,0xB1,0xAB,0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x95,
0x5D,0xAC,0x96,0xDF,0x73,0x8A,0x40,0x0F,0x99,0x07,0xD8,0x46,0x4E,0xB4,0x08,0x0F,
0x41,0x54,0x57,0x1A,0x41,0x0B,0x0A,0x9C,0x06,0xBF,0x0F,0x38,0xF7,0x50,0x11,0x8F,
0xD1,0xB1,0x7F,0x8E,0xDB,0xD2,0xF7,0x52,0xE7,0xC3,0xB9,0x50,0x58,0x83,0x89,0x35,
0x4C,0xE5,0xBC,0xF0,0x46,0x0F,0xF3,0xAC,0xDA,0x01,0x97,0x14,0xF3,0xD3,0xD4,0x98,
0x8D,0x9C,0x85,0x03,0x68,0xFF,0x00,0x2E,0xD9,0x5D,0xE0,0xA7,0x3C,0x38,0x49,0x81,
0x31,0xB8,0x89,0x27,0x2D,0x95,0x17,0x46,0x74,0x19,0x9D,0x8D,0x70,0x57,0xB6,0x18,
0x0D,0x3B,0xF3,0xFF,0x4B,0xD3,0x2B,0x74,0x71,0x52,0x03,0xD0,0x7A,0x86,0xE3,0x01,
0x7D,0x29,0x21,0x75,0x7B,0x8B,0x6E,0x77,0x89,0x3A,0xC8,0xD8,0x91,0xF3,0xE4,0xBD
};
const unsigned char Flash_access_pass[Flash_access_pass_SIZE] __attribute__ ((aligned (4)))=
{
// SWD/JTAG access code strings:
// For protection type 0 : JTAG/SWD no need access code
// For protection type 1 : 9C3B6C6C62D3D7940528C578B10813D0
// For protection type 2 : 9C3B6C6C62D3D7940528C578B1081390
// For protection type 3 : JTAG/SWD disabled
0x9C,0x3B,0x6C,0x6C,0x62,0xD3,0xD7,0x94,0x05,0x28,0xC5,0x78,0xB1,0x08,0x13,0x10
};
const unsigned char Monitor_pass[Monitor_pass_SIZE] = "SjPrCuheJ0J1DvJv";
const unsigned char Engnr_menu_pass[Engnr_menu_pass_SIZE] = "0lcowCKCJwMtCVpo";
const unsigned char WIFI_pass[WIFI_pass_SIZE] = "vwb4DlQfns5erFK8";
© Habrahabr.ru