Hi,
I hope everyone is doing well. I am a beginner on mbedtls and cryptography.
I hope you will understand if there is a lack of understanding or a rookie
mistake from my part.
So, My goal is to do a key-encryption key. I have an *RSA* private key file
"*private.pem*" generated by OpenSSL. I want to encrypt the content of
this "private.pem" with *AES* *encryption* and followed by *AES decryption
*on the encrypted data.
To do that, I read the "private.pem" file into a buffer and perform AES
encryption. The problem is when I perform the AES decryption operation I
get something else instead of the original "private.pem" data. I have a
working example of AES encryption/decryption working on plaintext
perfectly. So, I guess there is a flaw in my understanding of
encryption/decryption of byte64 encoded string.
Can someone please suggests me how can I encrypt RSA private key with AES?
Thanks,
Shariful
Mbed TLS version 2.24.0, 2.16.8 and 2.7.17 have been released recently. Version 2.7.17 is incorrectly marked as the latest release by github. Since this happens automatically based on the commit creation dates, this can’t be fixed until the next release.
We have extended the release notes of 2.7.17 to warn about this and changed the download links on the website.
We would like to confirm that version 2.24.0 is the latest release and the other two are the patch releases for the 2.16 and 2.7 long term support branches.
My apologies for the inconvenience and thank you for your support!
Best regards,
Janos
(On behalf of the Mbed TLS team)
--
Mbed-tls-announce mailing list
Mbed-tls-announce(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/mbed-tls-announce
Hello,
4096 bytes is a lot larger than a typical public key. 4096 *bits* is
common for an RSA key. Are you sure you're using the correct units?
By default the library doesn't support the creation of MPI that are
larger than 1024 bytes. This is a configuration option
(MBEDTLS_MPI_MAX_SIZE), although it's uncommon to change it (a larger
value is hardly ever necessary, and a smaller value won't save memory
except in RSA which needs at least 512 bytes for 4096-bit keys). However
mbedtls_mpi_write_file itself doesn't have any size limit.
Best regards,
--
Gilles Peskine
Mbed TLS developer
On 27/08/2020 13:27, youssouf sokhona via mbed-tls wrote:
>
> Hello everyone, I think you are fine during this crisis.
>
>
>
> I am working now with mbedtls modulee, and I wanted to print a
> function « mbedtls_mpi_write_file » to print the value of an MPI. This
> function works with common values.
>
>
>
> However, when I want to print an MPI which is very long (about 4096
> bytes, a public key), it doesn’t work. Someone knows how to solve this
> problem ?
>
>
>
> Thanks a lot
>
>
>
> Best regards, YS
>
>
>
>
Hello everyone, I think you are fine during this crisis.
I am working now with mbedtls modulee, and I wanted to print a function « mbedtls_mpi_write_file » to print the value of an MPI. This function works with common values.
However, when I want to print an MPI which is very long (about 4096 bytes, a public key), it doesn’t work. Someone knows how to solve this problem ?
Thanks a lot
Best regards, YS
Hi Youssouf,
I think you're looking for mbedtls_mpi_write_file() - just pass NULL as the file argument to write to stdout. You can use the radix argument to print out hex or decimal.
Regards,
Manuel.
________________________________
From: mbed-tls <mbed-tls-bounces(a)lists.trustedfirmware.org> on behalf of youssouf sokhona via mbed-tls <mbed-tls(a)lists.trustedfirmware.org>
Sent: 25 August 2020 15:40
To: mbed-tls(a)lists.trustedfirmware.org <mbed-tls(a)lists.trustedfirmware.org>
Subject: [mbed-tls] Set an MPI and print it
Hi everyone, I think you all are fine.
I am a beginner on mbedtls, and I wanted to set a dhm context. So, at first, I just want to set the value of the prime P, and the generator G. So to that I wrote the function below : [cid:image001.png@01D67AF5.D43FDE60]
To check if it is correctly set, I wanted to print it to see. However, it is not the case. Do you know how to set and print the value ?
Thanks, and have a good day
Best regards, YS
Hi everyone, I think you all are fine.
I am a beginner on mbedtls, and I wanted to set a dhm context. So, at first, I just want to set the value of the prime P, and the generator G. So to that I wrote the function below : [cid:image001.png@01D67AF5.D43FDE60]
To check if it is correctly set, I wanted to print it to see. However, it is not the case. Do you know how to set and print the value ?
Thanks, and have a good day
Best regards, YS
Hello everybody, I hope you are going well
I am creating a diffie Hellman key exchange program, so I am using functions like « mbedtls_dhm_init() » or « mbedtls_ctr_drbg_init() « for example. However, even if I defined the CTR_DRBG & the DHM_C module in the config.h file, and the header in my C file, I Always have error like that :
[cid:image002.png@01D6770C.20370D40]
Can someone help me to find out where does it come from ? Because I don’t know at all.
Thanks, and have a good day