 pkgnzone. Basically, what we want to do is to generate an RSA encryption with OpenSSL and then we will do it with a NWB55. That means I will create a project from scratch on this platform and we will try to reproduce an encryption that I have been done thanks OpenSSL. So for this nzone, we will use the STM32WB55 Nucleo and I propose to start a new project with STM32WB55. I will select the MCU selector, one that we expected is the one from the Nucleo. So this one. Okay let's test the pkgnzone. That's it. So the only thing we have to activate will be here. I want to activate the pkgnzone. As you can see, we can't configure it inside STM32WB55 at the moment. So we will do it this manually thanks HL. Let's generate the code. Okay, if we check what we've got in the main, it's quite simple. I will say we've got the pointers on the structure needed by the HL. We've got a pkgnzone. But in this pkgnzone, here you see no parameters. So we will need to do a new initialization on a proper one. So for the moment, I will say that we've got the infrastructures to put our code. Let's switch to OpenSSL to generate our test vector we will use now. So now I launched OpenSSL on my windows and we will generate together the vector test or what we want to reproduce with our pka on the STM32WB. So first thing, let me show you the version that I'm using just for your information. And now let's generate the RSI key. So my private PEM and we could select a size of 1,024. Okay, we could check the value generated, my private key. Okay, and we would like to see it in text form. So here I think now we are familiar with the structures. We've got the modulus, the public exponent, the private exponent, the 2 prime number, the exponent 1, exponent 2 and coefficient that could be used to do the CRT modulus exponential. Here we've got all the fields needed and we will just have to convert this to put them in the C structures for our test. Let's continue to, I will say, encrypt a file. So now I will extract the public key from this private key structure, I will say. From the public key, I want to have the public key and it will be put in my pubkey.pen. Okay, so now we only have the public key in the my pubkey.pen. I prepare for you a file that we will use as input. I propose something quite simple as you can see and align on the 1,024 bits for simplify the example. Okay, so this is our plain text and I want to encrypt this with the public key that we will have here. Okay, so the command is open ssl, eresa, and we will do a row conversion. We will use a public key as input, the in key with my public key.pen. We will do some encryption and we want to encrypt plaintext.pen and the output will be in plaintext.pen. Okay, if I just check the content of plaintext.pen, here we are. So now we've got our victor test. We've got the input or what we want to encrypt. We've got the output, the encrypted messages, and here we've got all the value public and private to do the encryption. In fact, we will only use a public key here. Okay, so what I propose is we will copy all this stuff in our C file and then we will put it in a command at the beginning. For example, in this part. Okay, so I would say what are we interested in. Here we've got the value for the key, for sure. We're going to keep them. This format is not interesting for us. We don't need the command. The plaintext is here and the encrypt text value is here. Okay, so let's have this first. I would say this is our victor test now we will use. Let's declare the C structures with our key value. So we'll take the mobirus, public and private exponent. Let's declare private variable with those values. For sure. Then I will probably convert all the value. Okay, for the public exponent we can do it directly. Exponent in the same way. Okay, to convert this I will just use text edit for example. Just copy past this. We can search and replace. So let's replace each point by this and then we've got replace. It's okay with this one. It should be okay. So this is for the modulus. Okay, just one remark. It started by zero and with open ssl there is a coding in isn1. When you've got zero zero to start that's just some things to indicate the sign of the value. So it's a positive one and you have to remove it if you want to have 128 bits. So please if you've got zero just remove them. Okay, it's a boring task. I do it with you that way you can see how I do it manually. Not very interesting but it has to be down. So I do the same for the private. There is not started with zero zero so no modification to be down. Okay, let's align the structure. It will be better. Okay, we are aligned on the size. Good, so key value are now defined. Let's define our plain text location. So the test victor we've chosen on this one. Okay, quite simple. So let's initialize it by ourself. Okay, so now we are I will say ready for the structures. Let's define also the output structures. So we will get the result which will be encrypted data and eventually decrypted data if we want to double check this. Okay, I will just try to compile just to check if I haven't made an instant X error. Good, so now we can have the happy high. So let's move to the main. Okay, we've got the Pekka and it's just done here. If we check in the code what we've got here. Pekka in it is done for the hash error. Good, let's come back to our main. And let's see what I want to do. It will be a module's exponent action. So module looks exponent. Okay, the structures we've got an input structure that we will see together. And here let's put some time out value for example. So let's check what is this input structure we have to use. So number of side of the exponent array, operation one number of element and modules. Okay, so I won't say it's trivial but it seems quite obvious regarding what we've got as input. So let's declare this variable here. So our input parameters. Okay, then so exponent size equal size of our public exponent addition to the job first, sorry. Then in that, hope the size is the size of the modules. Next one, our exponent. So here it's our public exponent, the modules and the last parameters. Oops, sorry. Our operand which will be our plain text. Okay, that's I think it's okay here. It's a pointer on the structure. So here we'll do the exponentiation to the operation will be down here. Let's check maybe the results or first if the status is okay or not. If it's different from a shell. Okay, add a hero here. And if it's working fine, we will need to get the results. So here we've got another happy eye for that. A mode X catch results. Okay, here the pk and we will put this in the encrypted encrypted data. Okay, let's compile this. I think it's okay. So now we need to debug. So I will launch the debug. Sorry, I'm plugging my board on a USB help, not bad idea. I will unplug it. I propose to add now the description. So it's exactly the same operation, but we won't use the same parameter. Here we will use the private exponents, private exponent here and we will use the encrypted data. We need here to increase because one second won't be enough for this description. Let's take five and should be okay. And let's put the result in decrypted data. Okay, I hope I haven't forget anything. Tim note and below. It will build my sources. Still have breakpoint on the white one. So here it's finished. Let check the encrypted data now. And we've got what is expected. So we have encrypt and decrypt. Okay, so it was exactly what I want to show you here with the pk. I hope you will like this hands on.