Re: Re: SonarLint complaining about "Use a stronger padding scheme"
Frank Sapone <[email protected]> Thu, 25 Apr 2024 05:59:01 -0700 (PDT)
| Newsgroups | gmane.comp.encryption.cryptopp |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_46516_1190168352.1714049941479
Content-Type: multipart/alternative;
boundary="----=_Part_46517_1712383823.1714049941479"
------=_Part_46517_1712383823.1714049941479
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
I based my code off the stuff in the wiki. So what am I doing wrong? I=20
just want the PSS to make the SCA shut up.
bool X509CertMod::CheckCertDate(bool bNotBefore)
{
bool bRetValue;
if (bNotBefore)
{
bRetValue =3D CertIsCurrentTimeAfter(notBeforeDate);
//printf("Created: %02d %02d, %02d %02d:%02d:%02dZ\n", monthInt, dayInt,=20
yearInt, hoursInt, minutesInt, secondsInt);
if (bRetValue)
{
//printf("* NotBefore in past. Can use.\n");
return true;
}
else
{
//printf("* NotBefore in future. Can't use!\n");
return false;
}
}
else
{
bRetValue =3D CertIsCurrentTimeAfter(notAfterDate);
//printf("Expires: %02d %02d, %02d %02d:%02d:%02dZ\n", monthInt, dayInt,=20
yearInt, hoursInt, minutesInt, secondsInt);
if (bRetValue)
{
//printf("* NotAfter in past. Can't use!\n");
return false;
}
else
{
//printf("* NotAfter in future. Can use.\n");
return true;
}
}
return false;
}
bool X509CertMod::LoadX509PEMCertificateFromString(const std::string=20
&certStr)
{
try
{
StringSource ss(certStr, true);
PEM_Load(ss, m_Cert);
m_CertStr =3D certStr;
notBeforeDate.SetDate(m_Cert.GetNotBefore().EncodeValue().c_str());
notAfterDate.SetDate(m_Cert.GetNotAfter().EncodeValue().c_str());
bLoaded =3D true;
return true;
}
catch (const std::exception &ex)
{
printf("Failed to load cert string: %s\n", ex.what());
}
return false;
}
bool X509CertMod::VerifyCert(void)
{
const SecByteBlock &signature =3D m_Cert.GetCertificateSignature();
const SecByteBlock &toBeSigned =3D m_Cert.GetToBeSigned();
const X509PublicKey &publicKey =3D m_Cert.GetSubjectPublicKey();
if (CheckCertDate(true))
{
if (CheckCertDate(false))
{
RSASS<PKCS1v15, SHA256>::Verifier verifier(publicKey);
bool result =3D verifier.VerifyMessage(toBeSigned, toBeSigned.size(),=20
signature, signature.size());
if (result)
{
//std::cout << "Verified root certificate" << std::endl;
return true;
}
//std::cout << "Failed to verify root certificate" << std::endl;
}
}
return false;
}
On Wednesday, April 24, 2024 at 1:59:49=E2=80=AFPM UTC-4 One Sini wrote:
> This code demonstrates how to load an X509 certificate and private/public=
=20
> keys from files.=20
>
>
> #include <iostream>
>
> #include <fstream>
>
> #include <string>
>
>
> #include <cryptopp/rsa.h>
>
> #include <cryptopp/files.h>
>
> #include <cryptopp/base64.h>
>
> #include <cryptopp/osrng.h>
>
> #include <cryptopp/pssr.h>
>
>
> using namespace CryptoPP;
>
> using namespace std;
>
>
> void loadX509Certificate(const string& certFile, X509Certificate&=20
> certificate) {
>
> ifstream file(certFile.c_str(), ios::in | ios::binary);
>
> if (!file) {
>
> cerr << "Error: Failed to open certificate file." << endl;
>
> // Handle error appropriately
>
> return;
>
> }
>
>
> try {
>
> PEM_Load(file, certificate);
>
> } catch (const Exception& ex) {
>
> cerr << "Error: Failed to load X509 certificate - " << ex.what()=
=20
> << endl;
>
> // Handle error appropriately
>
> return;
>
> }
>
> }
>
>
> void loadPrivateKey(const string& privateKeyFile, RSA::PrivateKey&=20
> privateKey) {
>
> ifstream file(privateKeyFile.c_str());
>
> if (!file) {
>
> cerr << "Error: Failed to open private key file." << endl;
>
> // Handle error appropriately
>
> return;
>
> }
>
>
> try {
>
> PEM_Load(file, privateKey);
>
> } catch (const Exception& ex) {
>
> cerr << "Error: Failed to load private key - " << ex.what() <<=20
> endl;
>
> // Handle error appropriately
>
> return;
>
> }
>
> }
>
>
> void loadPublicKey(const string& publicKeyFile, RSA::PublicKey& publicKey=
)=20
> {
>
> ifstream file(publicKeyFile.c_str());
>
> if (!file) {
>
> cerr << "Error: Failed to open public key file." << endl;
>
> // Handle error appropriately
>
> return;
>
> }
>
>
> try {
>
> PEM_Load(file, publicKey);
>
> } catch (const Exception& ex) {
>
> cerr << "Error: Failed to load public key - " << ex.what() << end=
l;
>
> // Handle error appropriately
>
> return;
>
> }
>
> }
>
>
> int main() {
>
> string certFile =3D "certificate.pem";
>
> string privateKeyFile =3D "private.key";
>
> string publicKeyFile =3D "public.key";
>
>
> X509Certificate certificate;
>
> RSA::PrivateKey privateKey;
>
> RSA::PublicKey publicKey;
>
>
> loadX509Certificate(certFile, certificate);
>
> loadPrivateKey(privateKeyFile, privateKey);
>
> loadPublicKey(publicKeyFile, publicKey);
>
>
> // Continue with using the certificate and keys...
>
>
> return 0;
>
> }
>
>
>
> One Sini <[email protected]> schrieb am Mi. 24. Apr. 2024 um 19:51:
>
>> Test this way
>>
>> a basic guide on how to generate an RSA key pair with PSS padding, sign=
=20
>> an X509 certificate with the private key, and verify the signature with =
the=20
>> public key using the Crypto++ library:
>>
>> 1. Generating an RSA Key Pair with PSS Padding:
>>
>> cpp
>>
>> Copy code
>>
>> #include <cryptopp/rsa.h>
>>
>> #include <cryptopp/osrng.h>
>>
>> #include <cryptopp/pssr.h>
>>
>>
>> using namespace CryptoPP;
>>
>>
>> void generateRSAKeyPair(RSA::PrivateKey& privateKey, RSA::PublicKey&=20
>> publicKey) {
>>
>> AutoSeededRandomPool rng;
>>
>>
>> InvertibleRSAFunction params;
>>
>> params.GenerateRandomWithKeySize(rng, 2048);
>>
>>
>> privateKey =3D RSA::PrivateKey(params);
>>
>> publicKey =3D RSA::PublicKey(params);
>>
>> }
>>
>>
>> int main() {
>>
>> RSA::PrivateKey privateKey;
>>
>> RSA::PublicKey publicKey;
>>
>>
>> generateRSAKeyPair(privateKey, publicKey);
>>
>>
>> // The RSA key pair has been generated and is now available
>>
>> return 0;
>>
>> }
>>
>> 1. Signing the X509 Certificate with the Private Key:
>>
>> cpp
>>
>>
>> Copy code
>>
>> #include <cryptopp/cryptlib.h>
>>
>> #include <cryptopp/oids.h>
>>
>> #include <cryptopp/rsa.h>
>>
>> #include <cryptopp/sha.h>
>>
>> #include <cryptopp/filters.h>
>>
>> #include <cryptopp/base64.h>
>>
>>
>> using namespace CryptoPP;
>>
>>
>> void signCertificate(const RSA::PrivateKey& privateKey, const X509&=20
>> certificate, byte* signature) {
>>
>> // Implement the process of signing the certificate here
>>
>> // Use privateKey and certificate to sign the certificate
>>
>> }
>>
>>
>> int main() {
>>
>> // Load or create your X509 certificate
>>
>> // Here, we assume you already have an X509 certificate
>>
>>
>> RSA::PrivateKey privateKey;
>>
>> // Load or generate your private key
>>
>> // Here, we assume you already have a private key
>>
>>
>> byte signature[256]; // Space for the signature
>>
>>
>> signCertificate(privateKey, certificate, signature);
>>
>>
>> // The certificate has been signed, and the signature is now availab=
le
>>
>> return 0;
>>
>> }
>>
>> 1. Verifying the Signature with the Public Key:
>>
>> cpp
>>
>>
>> Copy code
>>
>> #include <cryptopp/rsa.h>
>>
>> #include <cryptopp/sha.h>
>>
>> #include <cryptopp/filters.h>
>>
>> #include <cryptopp/base64.h>
>>
>>
>> using namespace CryptoPP;
>>
>>
>> bool verifySignature(const RSA::PublicKey& publicKey, const X509&=20
>> certificate, const byte* signature) {
>>
>> // Implement the process of verifying the signature here
>>
>> // Use publicKey, certificate, and signature
>>
>>
>> // Return true if the signature is valid, otherwise false
>>
>> return false;
>>
>> }
>>
>>
>> int main() {
>>
>> // Load or create your X509 certificate
>>
>> // Here, we assume you already have an X509 certificate
>>
>>
>> RSA::PublicKey publicKey;
>>
>> // Load or generate your public key
>>
>> // Here, we assume you already have a public key
>>
>>
>> byte signature[256]; // Take the signature from the certificate=20
>> signature
>>
>>
>> bool isValid =3D verifySignature(publicKey, certificate, signature);
>>
>>
>> // Check if the signature is valid
>>
>> return 0;
>>
>> }
>>
>> These code snippets serve as a foundation. You will need to adapt them=
=20
>> according to your specific implementation, including the loading process=
=20
>> for the X509 certificate and the private/public keys. Remember to includ=
e=20
>> error handling and handle edge cases in your implementation
>> I hope this help you
>> ;)
>>
>> Manish sharma <[email protected]> schrieb am Mi. 24. Apr. 2024 um=
=20
>> 14:42:
>>
>>> Crypto Betting <https://www.brsoftech.com/blog/crypto-sports-betting/>
>>>
>>> On Wed, Apr 24, 2024 at 6:08=E2=80=AFPM Frank Sapone <franksa...@gmail.=
com>=20
>>> wrote:
>>>
>>>> Has anyone figured out how to use PSS and SHA256 *WITH *CryptoPP-PEM? =
=20
>>>> I also tried reporting this to the issuer tracker at=20
>>>> https://github.com/noloader/cryptopp-pem and nobody has replied. I=20
>>>> can't imagine I'm the only person using this library in order to achie=
ve=20
>>>> this with X509 Certs.
>>>>
>>>> Thanks,
>>>> Frank
>>>>
>>>> On Wednesday, April 17, 2024 at 11:43:54=E2=80=AFAM UTC-4 HELA YAICH w=
rote:
>>>>
>>>>> Hello,=20
>>>>> (I'm new user of ns3 and crypto)=20
>>>>> I have link errors with Crypto++. These errors indicate that the=20
>>>>> compiler cannot find certain functions or classes defined in Crypto++=
. This=20
>>>>> can happen if Crypto++ is not correctly linked to my project. However=
, I=20
>>>>> tried to modify my project's CMakeLists.txt file as follows:=20
>>>>> set(target_prefix scratch_)
>>>>>
>>>>> function(create_scratch source_files)
>>>>> # Return early if no sources in the subdirectory
>>>>> list(LENGTH source_files number_sources)
>>>>> if(number_sources EQUAL 0)
>>>>> return()
>>>>> endif()
>>>>>
>>>>> # If the scratch has more than a source file, we need to find the=
=20
>>>>> source with
>>>>> # the main function
>>>>> set(scratch_src)
>>>>> foreach(source_file ${source_files})
>>>>> file(READ ${source_file} source_file_contents)
>>>>> string(REGEX MATCHALL "main[(| (]" main_position=20
>>>>> "${source_file_contents}")
>>>>> if(CMAKE_MATCH_0)
>>>>> set(scratch_src ${source_file})
>>>>> endif()
>>>>> endforeach()
>>>>>
>>>>> if(NOT scratch_src)
>>>>> return()
>>>>> endif()
>>>>>
>>>>> # Get parent directory name
>>>>> get_filename_component(scratch_dirname ${scratch_src} DIRECTORY)
>>>>> string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "" scratch_dirname
>>>>> "${scratch_dirname}"
>>>>> )
>>>>> string(REPLACE "/" "_" scratch_dirname "${scratch_dirname}")
>>>>>
>>>>> # Get source name
>>>>> get_filename_component(scratch_name ${scratch_src} NAME_WE)
>>>>>
>>>>> set(target_prefix scratch_)
>>>>> if(scratch_dirname)
>>>>> # Join the names together if dirname is not the scratch folder
>>>>> set(target_prefix scratch${scratch_dirname}_)
>>>>> endif()
>>>>>
>>>>> # Get source absolute path and transform into relative path
>>>>> get_filename_component(scratch_src ${scratch_src} ABSOLUTE)
>>>>> get_filename_component(scratch_absolute_directory ${scratch_src}=20
>>>>> DIRECTORY)
>>>>> string(REPLACE "${PROJECT_SOURCE_DIR}" "${CMAKE_OUTPUT_DIRECTORY}"
>>>>> scratch_directory ${scratch_absolute_directory}
>>>>> )
>>>>> add_executable(${target_prefix}${scratch_name} "${source_files}")
>>>>> if(${NS3_STATIC})
>>>>> target_link_libraries(
>>>>> ${target_prefix}${scratch_name} ${LIB_AS_NEEDED_PRE_STATIC}
>>>>> ${lib-ns3-static}
>>>>> )
>>>>> else()
>>>>> target_link_libraries(
>>>>> ${target_prefix}${scratch_name} "${ns3-libs}"=20
>>>>> "${ns3-contrib-libs}"
>>>>> "${ns3-external-libs}"
>>>>> )
>>>>> endif()
>>>>> set_runtime_outputdirectory(
>>>>> ${scratch_name} ${scratch_directory}/ ${target_prefix}
>>>>> )
>>>>> endfunction()
>>>>>
>>>>> # Scan *.cc files in ns-3-dev/scratch and build a target for each
>>>>> file(GLOB single_source_file_scratches CONFIGURE_DEPENDS=20
>>>>> ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)
>>>>> foreach(scratch_src ${single_source_file_scratches})
>>>>> create_scratch(${scratch_src})
>>>>> endforeach()
>>>>>
>>>>> # Scan *.cc files in ns-3-dev/scratch subdirectories and build a=20
>>>>> target for each
>>>>> # subdirectory
>>>>> file(
>>>>> GLOB_RECURSE scratch_subdirectories
>>>>> CONFIGURE_DEPENDS
>>>>> LIST_DIRECTORIES true
>>>>> ${CMAKE_CURRENT_SOURCE_DIR}/**
>>>>> )
>>>>> # Filter out files
>>>>> foreach(entry ${scratch_subdirectories})
>>>>> if(NOT (IS_DIRECTORY ${entry}))
>>>>> list(REMOVE_ITEM scratch_subdirectories ${entry})
>>>>> endif()
>>>>> endforeach()
>>>>>
>>>>> foreach(subdir ${scratch_subdirectories})
>>>>> if(EXISTS ${subdir}/CMakeLists.txt)
>>>>> # If the subdirectory contains a CMakeLists.txt file
>>>>> # we let the CMake file manage the source files
>>>>> #
>>>>> # Use this if you want to link to external libraries
>>>>> # without creating a module
>>>>> add_subdirectory(${subdir})
>>>>> else()
>>>>> # Otherwise we pick all the files in the subdirectory
>>>>> # and create a scratch for them automatically
>>>>> file(GLOB scratch_sources CONFIGURE_DEPENDS ${subdir}/*.cc)
>>>>> create_scratch("${scratch_sources}")
>>>>> endif()
>>>>> endforeach()
>>>>> find_external_library(DEPENDENCY_NAME cryptopp
>>>>> HEADER_NAME aes.h
>>>>> LIBRARY_NAME cryptopp
>>>>> SEARCH_PATHS /usr/include/cryptopp)
>>>>>
>>>>>
>>>>> if(${CRYPTOPP_FOUND}) # Notice that the contents of DEPENDENCY_NAME=
=20
>>>>> became a prefix for the _FOUND variable
>>>>> find_package(cryptopp REQUIRED)
>>>>> include_directories(${CRYPTOPP_INCLUDE_DIRS})
>>>>> link_libraries(${CRYPTOPP_LIBRARIES})
>>>>> endif()
>>>>> add_executable(${target_prefix}${scratch_name} "fanetex.cc")
>>>>> target_link_libraries(${target_prefix}${scratch_name} PRIVATE cryptop=
p)
>>>>>
>>>>> can you help me to solve this problem ? Thank you [image: Capture=20
>>>>> d=E2=80=99=C3=A9cran 2024-04-17 114345.png]
>>>>>
>>>>> Le mardi 16 avril 2024 =C3=A0 21:53:22 UTC-5, Frank Sapone a =C3=A9cr=
it :
>>>>>
>>>>>> I grabbed it but it's not relevant. I need to have a certificate=20
>>>>>> with RSA PSS that can be read by CryptoPP with the X509Cert lib. Is=
it=20
>>>>>> possible to do this?
>>>>>>
>>>>>> On Tuesday, April 16, 2024 at 3:19:47=E2=80=AFPM UTC-4 Jeffrey Walto=
n wrote:
>>>>>>
>>>>>>> On Tue, Apr 16, 2024 at 1:44=E2=80=AFPM One Sini <[email protected]>=
wrote:
>>>>>>>
>>>>>>>> I wasn't entirely satisfied with the security, so I've adjusted th=
e=20
>>>>>>>> code. I'm not sure if that helps you, depending on what you're doi=
ng with=20
>>>>>>>> it.
>>>>>>>>
>>>>>>>> This code uses RSA with OAEP (Optimal Asymmetric Encryption=20
>>>>>>>> Padding) to avoid security issues like padding oracle attacks. It =
generates=20
>>>>>>>> RSA keys with a length of 2048 bits, encrypts the message with OAE=
P=20
>>>>>>>> padding, and then decrypts it.
>>>>>>>>
>>>>>>>> Best Regards Satoshi=20
>>>>>>>>
>>>>>>>
>>>>>>> I deleted the message from the group. The *.pdf and *.pages smells=
=20
>>>>>>> of malware.
>>>>>>>
>>>>>>> If you want to provide code, please inline it or provide it as a=20
>>>>>>> text attachment.
>>>>>>>
>>>>>>> Jeff
>>>>>>>
>>>>>>>> --=20
>>>> You received this message because you are subscribed to the Google=20
>>>> Groups "Crypto++ Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send=
=20
>>>> an email to [email protected].
>>>> To view this discussion on the web visit=20
>>>> https://groups.google.com/d/msgid/cryptopp-users/db9bad9f-be9e-4a25-a0=
9f-d52ce28adec0n%40googlegroups.com=20
>>>> <https://groups.google.com/d/msgid/cryptopp-users/db9bad9f-be9e-4a25-a=
09f-d52ce28adec0n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter=
>
>>>> .
>>>>
>>>
>>>
>>> --=20
>>> Kind Regards,=20
>>> Manish Kr. Sharma=20
>>> Digital Marketing Manager
>>>
>>> Website: www.brsoftech.com
>>> E-mail: [email protected]
>>>
>>>
>>>
>>> --=20
>>> You received this message because you are subscribed to the Google=20
>>> Groups "Crypto++ Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send=
=20
>>> an email to [email protected].
>>> To view this discussion on the web visit=20
>>> https://groups.google.com/d/msgid/cryptopp-users/CABUB1NSTdFJPHBeh9b-fq=
fjrQBUWVzDzjNdjYUAQpzBb9CQsZw%40mail.gmail.com=20
>>> <https://groups.google.com/d/msgid/cryptopp-users/CABUB1NSTdFJPHBeh9b-f=
qfjrQBUWVzDzjNdjYUAQpzBb9CQsZw%40mail.gmail.com?utm_medium=3Demail&utm_sour=
ce=3Dfooter>
>>> .
>>>
>>
--=20
You received this message because you are subscribed to the Google Groups "=
Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/=
cryptopp-users/18b7e58b-9c58-484f-8bed-69a63f8be39dn%40googlegroups.com.
------=_Part_46517_1712383823.1714049941479
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
I based my code off the stuff in the wiki.=C2=A0 So what am I doing wrong?=
=C2=A0 I just want the PSS to make the SCA shut up.<br /><br />bool X509Cer=
tMod::CheckCertDate(bool bNotBefore)<br />{<br /><span style=3D"white-space=
: pre;"> </span>bool bRetValue;<br /><span style=3D"white-space: pre;"> </s=
pan>if (bNotBefore)<br /><span style=3D"white-space: pre;"> </span>{<br /><=
span style=3D"white-space: pre;"> </span>bRetValue =3D CertIsCurrentTimeAf=
ter(notBeforeDate);<br /><span style=3D"white-space: pre;"> </span>//print=
f("Created: %02d %02d, %02d %02d:%02d:%02dZ\n", monthInt, dayInt, yearInt, =
hoursInt, minutesInt, secondsInt);<br /><span style=3D"white-space: pre;"> =
</span>if (bRetValue)<br /><span style=3D"white-space: pre;"> </span>{<br=
/><span style=3D"white-space: pre;"> </span>//printf("* NotBefore in pas=
t. =C2=A0Can use.\n");<br /><span style=3D"white-space: pre;"> </span>ret=
urn true;<br /><span style=3D"white-space: pre;"> </span>}<br /><span styl=
e=3D"white-space: pre;"> </span>else<br /><span style=3D"white-space: pre;=
"> </span>{<br /><span style=3D"white-space: pre;"> </span>//printf("* N=
otBefore in future. =C2=A0Can't use!\n");<br /><span style=3D"white-space: =
pre;"> </span>return false;<br /><span style=3D"white-space: pre;"> </sp=
an>}<br /><span style=3D"white-space: pre;"> </span>}<br /><span style=3D"w=
hite-space: pre;"> </span>else<br /><span style=3D"white-space: pre;"> </sp=
an>{<br /><span style=3D"white-space: pre;"> </span>bRetValue =3D CertIsCu=
rrentTimeAfter(notAfterDate);<br /><span style=3D"white-space: pre;"> </sp=
an>//printf("Expires: %02d %02d, %02d %02d:%02d:%02dZ\n", monthInt, dayInt,=
yearInt, hoursInt, minutesInt, secondsInt);<br /><span style=3D"white-spac=
e: pre;"> </span>if (bRetValue)<br /><span style=3D"white-space: pre;"> <=
/span>{<br /><span style=3D"white-space: pre;"> </span>//printf("* NotAft=
er in past. =C2=A0Can't use!\n");<br /><span style=3D"white-space: pre;"> =
</span>return false;<br /><span style=3D"white-space: pre;"> </span>}<br =
/><span style=3D"white-space: pre;"> </span>else<br /><span style=3D"white=
-space: pre;"> </span>{<br /><span style=3D"white-space: pre;"> </span>/=
/printf("* NotAfter in future. =C2=A0Can use.\n");<br /><span style=3D"whit=
e-space: pre;"> </span>return true;<br /><span style=3D"white-space: pre;=
"> </span>}<br /><span style=3D"white-space: pre;"> </span>}<br /><br /><s=
pan style=3D"white-space: pre;"> </span>return false;<br />}<br /><br />boo=
l X509CertMod::LoadX509PEMCertificateFromString(const std::string &cert=
Str)<br />{<br /><span style=3D"white-space: pre;"> </span>try<br /><span s=
tyle=3D"white-space: pre;"> </span>{<br /><span style=3D"white-space: pre;"=
> </span>StringSource ss(certStr, true);<br /><br /><span style=3D"white-s=
pace: pre;"> </span>PEM_Load(ss, m_Cert);<br /><span style=3D"white-space:=
pre;"> </span>m_CertStr =3D certStr;<br /><br /><span style=3D"white-spac=
e: pre;"> </span>notBeforeDate.SetDate(m_Cert.GetNotBefore().EncodeValue()=
.c_str());<br /><span style=3D"white-space: pre;"> </span>notAfterDate.Set=
Date(m_Cert.GetNotAfter().EncodeValue().c_str());<br /><span style=3D"white=
-space: pre;"> </span>bLoaded =3D true;<br /><span style=3D"white-space: p=
re;"> </span>return true;<br /><span style=3D"white-space: pre;"> </span>}=
<br /><span style=3D"white-space: pre;"> </span>catch (const std::exception=
&ex)<br /><span style=3D"white-space: pre;"> </span>{<br /><span style=
=3D"white-space: pre;"> </span>printf("Failed to load cert string: %s\n", =
ex.what());<br /><span style=3D"white-space: pre;"> </span>}<br /><br /><sp=
an style=3D"white-space: pre;"> </span>return false;<br />}<br /><br /><div=
>bool X509CertMod::VerifyCert(void)<br />{<br /><span style=3D"white-space:=
pre;"> </span>const SecByteBlock &signature =3D m_Cert.GetCertificateS=
ignature();<br /><span style=3D"white-space: pre;"> </span>const SecByteBlo=
ck &toBeSigned =3D m_Cert.GetToBeSigned();<br /><span style=3D"white-sp=
ace: pre;"> </span>const X509PublicKey &publicKey =3D m_Cert.GetSubject=
PublicKey();<br /><br /><span style=3D"white-space: pre;"> </span>if (Check=
CertDate(true))<br /><span style=3D"white-space: pre;"> </span>{<br /><span=
style=3D"white-space: pre;"> </span>if (CheckCertDate(false))<br /><span =
style=3D"white-space: pre;"> </span>{<br /><span style=3D"white-space: pre=
;"> </span>RSASS<PKCS1v15, SHA256>::Verifier verifier(publicKey);<b=
r /><span style=3D"white-space: pre;"> </span>bool result =3D verifier.Ve=
rifyMessage(toBeSigned, toBeSigned.size(), signature, signature.size());<br=
/><span style=3D"white-space: pre;"> </span>if (result)<br /><span style=
=3D"white-space: pre;"> </span>{<br /><span style=3D"white-space: pre;"> =
</span>//std::cout << "Verified root certificate" << std::en=
dl;<br /><span style=3D"white-space: pre;"> </span>return true;<br /><sp=
an style=3D"white-space: pre;"> </span>}<br /><br /><span style=3D"white-=
space: pre;"> </span>//std::cout << "Failed to verify root certific=
ate" << std::endl;<br /><span style=3D"white-space: pre;"> </span>}<=
br /><span style=3D"white-space: pre;"> </span>}<br /><br /><span style=3D"=
white-space: pre;"> </span>return false;<br />}<br /><br /></div><div class=
=3D"gmail_quote"><div dir=3D"auto" class=3D"gmail_attr">On Wednesday, April=
24, 2024 at 1:59:49=E2=80=AFPM UTC-4 One Sini wrote:<br/></div><blockquote=
class=3D"gmail_quote" style=3D"margin: 0 0 0 0.8ex; border-left: 1px solid=
rgb(204, 204, 204); padding-left: 1ex;"><div>
<div>
<p><div><span style=3D"color:rgb(0,0,0);font-family:'-apple-system'=
,'helveticaneue';font-size:16px;font-style:normal;font-weight:400;l=
etter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal=
;word-spacing:0px;text-decoration:none;display:inline!important;float:none"=
>This code demonstrates how to load an X509 certificate and private/public =
keys from files.=C2=A0</span></div><p><br></p>#include <iostream></p>
<p>#include <fstream></p>
<p>#include <string></p>
<p><br></p>
<p>#include <cryptopp/rsa.h></p>
<p>#include <cryptopp/files.h></p>
<p>#include <cryptopp/base64.h></p></div></div><div><div>
<p>#include <cryptopp/osrng.h></p>
<p>#include <cryptopp/pssr.h></p>
<p><br></p>
<p>using namespace CryptoPP;</p>
</div></div><div><div><p>using namespace std;</p>
<p><br></p>
<p>void loadX509Certificate(const string& certFile, X509Certificate&=
; certificate) {</p>
<p>=C2=A0 =C2=A0 ifstream file(certFile.c_str(), ios::in | ios::binary);</p=
>
<p>=C2=A0 =C2=A0 if (!file) {</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 cerr << "Error: Failed to open ce=
rtificate file." << endl;</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 // Handle error appropriately</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;</p>
<p>=C2=A0 =C2=A0 }</p>
<p><br></p>
<p>=C2=A0 =C2=A0 try {</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 PEM_Load(file, certificate);</p>
<p>=C2=A0 =C2=A0 } catch (const Exception& ex) {</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 cerr << "Error: Failed to load X5=
09 certificate - " << ex.what() << endl;</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 // Handle error appropriately</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;</p>
<p>=C2=A0 =C2=A0 }</p>
<p>}</p>
<p><br></p>
<p>void loadPrivateKey(const string& privateKeyFile, RSA::PrivateKey&am=
p; privateKey) {</p>
<p>=C2=A0 =C2=A0 ifstream file(privateKeyFile.c_str());</p>
<p>=C2=A0 =C2=A0 if (!file) {</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 cerr << "Error: Failed to open pr=
ivate key file." << endl;</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 // Handle error appropriately</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;</p>
<p>=C2=A0 =C2=A0 }</p>
<p><br></p>
<p>=C2=A0 =C2=A0 try {</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 PEM_Load(file, privateKey);</p>
<p>=C2=A0 =C2=A0 } catch (const Exception& ex) {</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 cerr << "Error: Failed to load pr=
ivate key - " << ex.what() << endl;</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 // Handle error appropriately</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;</p>
<p>=C2=A0 =C2=A0 }</p>
<p>}</p>
<p><br></p>
<p>void loadPublicKey(const string& publicKeyFile, RSA::PublicKey& =
publicKey) {</p>
<p>=C2=A0 =C2=A0 ifstream file(publicKeyFile.c_str());</p>
<p>=C2=A0 =C2=A0 if (!file) {</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 cerr << "Error: Failed to open pu=
blic key file." << endl;</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 // Handle error appropriately</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;</p>
<p>=C2=A0 =C2=A0 }</p>
<p><br></p>
<p>=C2=A0 =C2=A0 try {</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 PEM_Load(file, publicKey);</p>
<p>=C2=A0 =C2=A0 } catch (const Exception& ex) {</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 cerr << "Error: Failed to load pu=
blic key - " << ex.what() << endl;</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 // Handle error appropriately</p>
<p>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;</p>
<p>=C2=A0 =C2=A0 }</p>
<p>}</p>
<p><br></p>
<p>int main() {</p>
<p>=C2=A0 =C2=A0 string certFile =3D "certificate.pem";</p>
<p>=C2=A0 =C2=A0 string privateKeyFile =3D "private.key";</p>
<p>=C2=A0 =C2=A0 string publicKeyFile =3D "public.key";</p>
<p><br></p>
<p>=C2=A0 =C2=A0 X509Certificate certificate;</p></div></div><div><div>
<p>=C2=A0 =C2=A0 RSA::PrivateKey privateKey;</p>
<p>=C2=A0 =C2=A0 RSA::PublicKey publicKey;</p>
<p><br></p>
</div></div><div><div><p>=C2=A0 =C2=A0 loadX509Certificate(certFile, certif=
icate);</p>
<p>=C2=A0 =C2=A0 loadPrivateKey(privateKeyFile, privateKey);</p>
<p>=C2=A0 =C2=A0 loadPublicKey(publicKeyFile, publicKey);</p>
<p><br></p>
<p>=C2=A0 =C2=A0 // Continue with using the certificate and keys...</p>
<p><br></p>
<p>=C2=A0 =C2=A0 return 0;</p>
<p>}</p>
<p><br></p>
<p><br></p></div></div><div><div class=3D"gmail_quote"><div dir=3D"ltr" cla=
ss=3D"gmail_attr">One Sini <<a href data-email-masked rel=3D"nofollow">o=
[email protected]</a>> schrieb am Mi. 24. Apr. 2024 um 19:51:<br></div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #=
ccc solid;padding-left:1ex"><div dir=3D"auto">Test this way</div><div dir=
=3D"auto"><br></div><div dir=3D"auto"><div>
<div>
<p>a basic guide on how to generate an RSA key pair with PSS padding, sign =
an X509 certificate with the private key, and verify the signature with the=
public key using the Crypto++ library:</p>
<ol><li>Generating an RSA Key Pair with PSS Padding:</li></ol>
<p>cpp</p>
<p>Copy code<br></p>
<p>#include <cryptopp/rsa.h></p>
<p>#include <cryptopp/osrng.h></p>
<p>#include <cryptopp/pssr.h></p>
<p><br></p>
<p>using namespace CryptoPP;</p>
<p><br></p>
<p>void generateRSAKeyPair(RSA::PrivateKey& privateKey, RSA::PublicKey&=
amp; publicKey) {</p>
<p>=C2=A0 =C2=A0 AutoSeededRandomPool rng;</p>
<p><br></p>
<p>=C2=A0 =C2=A0 InvertibleRSAFunction params;</p>
<p>=C2=A0 =C2=A0 params.GenerateRandomWithKeySize(rng, 2048);</p>
<p><br></p>
<p>=C2=A0 =C2=A0 privateKey =3D RSA::PrivateKey(params);</p>
<p>=C2=A0 =C2=A0 publicKey =3D RSA::PublicKey(params);</p>
<p>}</p>
<p><br></p>
<p>int main() {</p>
<p>=C2=A0 =C2=A0 RSA::PrivateKey privateKey;</p>
<p>=C2=A0 =C2=A0 RSA::PublicKey publicKey;</p>
<p><br></p>
<p>=C2=A0 =C2=A0 generateRSAKeyPair(privateKey, publicKey);</p>
<p><br></p>
<p>=C2=A0 =C2=A0 // The RSA key pair has been generated and is now availabl=
e</p>
<p>=C2=A0 =C2=A0 return 0;</p>
<p>}</p>
<ol><li>Signing the X509 Certificate with the Private Key:</li></ol>
<p>cpp</p>
<p><br></p>
<p>Copy code</p>
<p>#include <cryptopp/cryptlib.h></p>
<p>#include <cryptopp/oids.h></p>
<p>#include <cryptopp/rsa.h></p>
<p>#include <cryptopp/sha.h></p>
<p>#include <cryptopp/filters.h></p>
<p>#include <cryptopp/base64.h></p>
<p><br></p>
<p>using namespace CryptoPP;</p>
<p><br></p>
<p>void signCertificate(const RSA::PrivateKey& privateKey, const X509&a=
mp; certificate, byte* signature) {</p>
<p>=C2=A0 =C2=A0 // Implement the process of signing the certificate here</=
p>
<p>=C2=A0 =C2=A0 // Use privateKey and certificate to sign the certificate<=
/p>
<p>}</p>
<p><br></p>
<p>int main() {</p>
<p>=C2=A0 =C2=A0 // Load or create your X509 certificate</p>
<p>=C2=A0 =C2=A0 // Here, we assume you already have an X509 certificate</p=
>
<p><br></p>
<p>=C2=A0 =C2=A0 RSA::PrivateKey privateKey;</p>
<p>=C2=A0 =C2=A0 // Load or generate your private key</p>
<p>=C2=A0 =C2=A0 // Here, we assume you already have a private key</p>
<p><br></p>
<p>=C2=A0 =C2=A0 byte signature[256]; // Space for the signature</p>
<p><br></p>
<p>=C2=A0 =C2=A0 signCertificate(privateKey, certificate, signature);</p>
<p><br></p>
<p>=C2=A0 =C2=A0 // The certificate has been signed, and the signature is n=
ow available</p>
<p>=C2=A0 =C2=A0 return 0;</p>
<p>}</p>
<ol><li>Verifying the Signature with the Public Key:</li></ol>
<p>cpp</p>
<p><br></p>
<p>Copy code</p>
<p>#include <cryptopp/rsa.h></p>
<p>#include <cryptopp/sha.h></p>
<p>#include <cryptopp/filters.h></p>
<p>#include <cryptopp/base64.h></p>
<p><br></p>
<p>using namespace CryptoPP;</p>
<p><br></p>
<p>bool verifySignature(const RSA::PublicKey& publicKey, const X509&=
; certificate, const byte* signature) {</p>
<p>=C2=A0 =C2=A0 // Implement the process of verifying the signature here</=
p>
<p>=C2=A0 =C2=A0 // Use publicKey, certificate, and signature</p>
<p><br></p>
<p>=C2=A0 =C2=A0 // Return true if the signature is valid, otherwise false<=
/p>
<p>=C2=A0 =C2=A0 return false;</p>
<p>}</p>
<p><br></p>
<p>int main() {</p>
<p>=C2=A0 =C2=A0 // Load or create your X509 certificate</p>
<p>=C2=A0 =C2=A0 // Here, we assume you already have an X509 certificate</p=
>
<p><br></p>
<p>=C2=A0 =C2=A0 RSA::PublicKey publicKey;</p>
<p>=C2=A0 =C2=A0 // Load or generate your public key</p>
<p>=C2=A0 =C2=A0 // Here, we assume you already have a public key</p>
<p><br></p>
<p>=C2=A0 =C2=A0 byte signature[256]; // Take the signature from the certif=
icate signature</p>
<p><br></p>
<p>=C2=A0 =C2=A0 bool isValid =3D verifySignature(publicKey, certificate, s=
ignature);</p>
<p><br></p>
<p>=C2=A0 =C2=A0 // Check if the signature is valid</p>
<p>=C2=A0 =C2=A0 return 0;</p>
<p>}</p>
<p>These code snippets serve as a foundation. You will need to adapt them a=
ccording to your specific implementation, including the loading process for=
the X509 certificate and the private/public keys. Remember to include erro=
r handling and handle edge cases in your implementation</p>
</div>
</div>I hope this help you</div><div dir=3D"auto">;)</div><div><br><div cla=
ss=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">Manish sharma <=
<a href data-email-masked rel=3D"nofollow">[email protected]</a>> =
schrieb am Mi. 24. Apr. 2024 um 14:42:<br></div><blockquote class=3D"gmail_=
quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1=
ex"><div dir=3D"ltr"><a href=3D"https://www.brsoftech.com/blog/crypto-sport=
s-betting/" target=3D"_blank" rel=3D"nofollow" data-saferedirecturl=3D"http=
s://www.google.com/url?hl=3Den&q=3Dhttps://www.brsoftech.com/blog/crypt=
o-sports-betting/&source=3Dgmail&ust=3D1714136079669000&usg=3DA=
OvVaw04yc6TmtJWdHFrel0IXUZg">Crypto Betting=C2=A0</a></div><br><div class=
=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Apr 24, 2024=
at 6:08=E2=80=AFPM Frank Sapone <<a href data-email-masked rel=3D"nofol=
low">[email protected]</a>> wrote:<br></div><blockquote class=3D"gmai=
l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20=
4,204);padding-left:1ex">Has anyone figured out how to use PSS and SHA256 <=
b><i>WITH</i>=C2=A0</b>CryptoPP-PEM?=C2=A0 I also tried reporting this to t=
he issuer tracker at=C2=A0<a href=3D"https://github.com/noloader/cryptopp-p=
em" target=3D"_blank" rel=3D"nofollow" data-saferedirecturl=3D"https://www.=
google.com/url?hl=3Den&q=3Dhttps://github.com/noloader/cryptopp-pem&=
;source=3Dgmail&ust=3D1714136079669000&usg=3DAOvVaw1lFPOs0IKX0lBM4V=
W5aBRG">https://github.com/noloader/cryptopp-pem</a> and nobody has replied=
.=C2=A0 I can't imagine I'm the only person using this library in o=
rder to achieve this with X509 Certs.<div><br></div><div>Thanks,<br>Frank<b=
r><div><br></div></div><div class=3D"gmail_quote"><div dir=3D"auto" class=
=3D"gmail_attr">On Wednesday, April 17, 2024 at 11:43:54=E2=80=AFAM UTC-4 H=
ELA YAICH wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin=
:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"=
>Hello,=C2=A0<br>(I'm new user of ns3 and crypto)=C2=A0<br>I have link =
errors with Crypto++. These errors indicate that the compiler cannot find c=
ertain functions or classes defined in Crypto++. This can happen if Crypto+=
+ is not correctly linked to my project. However, I tried to modify my proj=
ect's CMakeLists.txt file as follows: <br>set(target_prefix scratch_)<b=
r><br>function(create_scratch source_files)<br>=C2=A0 # Return early if no =
sources in the subdirectory<br>=C2=A0 list(LENGTH source_files number_sourc=
es)<br>=C2=A0 if(number_sources EQUAL 0)<br>=C2=A0 =C2=A0 return()<br>=C2=
=A0 endif()<br><br>=C2=A0 # If the scratch has more than a source file, we =
need to find the source with<br>=C2=A0 # the main function<br>=C2=A0 set(sc=
ratch_src)<br>=C2=A0 foreach(source_file ${source_files})<br>=C2=A0 =C2=A0 =
file(READ ${source_file} source_file_contents)<br>=C2=A0 =C2=A0 string(REGE=
X MATCHALL "main[(| (]" main_position "${source_file_content=
s}")<br>=C2=A0 =C2=A0 if(CMAKE_MATCH_0)<br>=C2=A0 =C2=A0 =C2=A0 set(sc=
ratch_src ${source_file})<br>=C2=A0 =C2=A0 endif()<br>=C2=A0 endforeach()<b=
r><br>=C2=A0 if(NOT scratch_src)<br>=C2=A0 =C2=A0 return()<br>=C2=A0 endif(=
)<br><br>=C2=A0 # Get parent directory name<br>=C2=A0 get_filename_componen=
t(scratch_dirname ${scratch_src} DIRECTORY)<br>=C2=A0 string(REPLACE "=
${CMAKE_CURRENT_SOURCE_DIR}" "" scratch_dirname<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"${scratch_dirn=
ame}"<br>=C2=A0 )<br>=C2=A0 string(REPLACE "/" "_"=
scratch_dirname "${scratch_dirname}")<br><br>=C2=A0 # Get source=
name<br>=C2=A0 get_filename_component(scratch_name ${scratch_src} NAME_WE)=
<br><br>=C2=A0 set(target_prefix scratch_)<br>=C2=A0 if(scratch_dirname)<br=
>=C2=A0 =C2=A0 # Join the names together if dirname is not the scratch fold=
er<br>=C2=A0 =C2=A0 set(target_prefix scratch${scratch_dirname}_)<br>=C2=A0=
endif()<br><br>=C2=A0 # Get source absolute path and transform into relati=
ve path<br>=C2=A0 get_filename_component(scratch_src ${scratch_src} ABSOLUT=
E)<br>=C2=A0 get_filename_component(scratch_absolute_directory ${scratch_sr=
c} DIRECTORY)<br>=C2=A0 string(REPLACE "${PROJECT_SOURCE_DIR}" &q=
uot;${CMAKE_OUTPUT_DIRECTORY}"<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0scratch_directory ${scratch_absolute_directory}<=
br>=C2=A0 )<br>=C2=A0 add_executable(${target_prefix}${scratch_name} "=
${source_files}")<br>=C2=A0 if(${NS3_STATIC})<br>=C2=A0 =C2=A0 target_=
link_libraries(<br>=C2=A0 =C2=A0 =C2=A0 ${target_prefix}${scratch_name} ${L=
IB_AS_NEEDED_PRE_STATIC}<br>=C2=A0 =C2=A0 =C2=A0 ${lib-ns3-static}<br>=C2=
=A0 =C2=A0 )<br>=C2=A0 else()<br>=C2=A0 =C2=A0 target_link_libraries(<br>=
=C2=A0 =C2=A0 =C2=A0 ${target_prefix}${scratch_name} "${ns3-libs}"=
; "${ns3-contrib-libs}"<br>=C2=A0 =C2=A0 =C2=A0 "${ns3-exter=
nal-libs}"<br>=C2=A0 =C2=A0 )<br>=C2=A0 endif()<br>=C2=A0 set_runtime_=
outputdirectory(<br>=C2=A0 =C2=A0 ${scratch_name} ${scratch_directory}/ ${t=
arget_prefix}<br>=C2=A0 )<br>endfunction()<br><br># Scan *.cc files in ns-3=
-dev/scratch and build a target for each<br>file(GLOB single_source_file_sc=
ratches CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cc)<br>foreach(scra=
tch_src ${single_source_file_scratches})<br>=C2=A0 create_scratch(${scratch=
_src})<br>endforeach()<br><br># Scan *.cc files in ns-3-dev/scratch subdire=
ctories and build a target for each<br># subdirectory<br>file(<br>=C2=A0 GL=
OB_RECURSE scratch_subdirectories<br>=C2=A0 CONFIGURE_DEPENDS<br>=C2=A0 LIS=
T_DIRECTORIES true<br>=C2=A0 ${CMAKE_CURRENT_SOURCE_DIR}/**<br>)<br># Filte=
r out files<br>foreach(entry ${scratch_subdirectories})<br>=C2=A0 if(NOT (I=
S_DIRECTORY ${entry}))<br>=C2=A0 =C2=A0 list(REMOVE_ITEM scratch_subdirecto=
ries ${entry})<br>=C2=A0 endif()<br>endforeach()<br><br>foreach(subdir ${sc=
ratch_subdirectories})<br>=C2=A0 if(EXISTS ${subdir}/CMakeLists.txt)<br>=C2=
=A0 =C2=A0 # If the subdirectory contains a CMakeLists.txt file<br>=C2=A0 =
=C2=A0 # we let the CMake file manage the source files<br>=C2=A0 =C2=A0 #<b=
r>=C2=A0 =C2=A0 # Use this if you want to link to external libraries<br>=C2=
=A0 =C2=A0 # without creating a module<br>=C2=A0 =C2=A0 add_subdirectory(${=
subdir})<br>=C2=A0 else()<br>=C2=A0 =C2=A0 # Otherwise we pick all the file=
s in the subdirectory<br>=C2=A0 =C2=A0 # and create a scratch for them auto=
matically<br>=C2=A0 =C2=A0 file(GLOB scratch_sources CONFIGURE_DEPENDS ${su=
bdir}/*.cc)<br>=C2=A0 =C2=A0 create_scratch("${scratch_sources}")=
<br>=C2=A0 endif()<br>endforeach()<br>find_external_library(DEPENDENCY_NAME=
cryptopp<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 HEADER_NAME aes.h<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 LIBRARY_NAME cryptopp<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SEARCH_P=
ATHS /usr/include/cryptopp)<br><br><br>if(${CRYPTOPP_FOUND}) # Notice that =
the contents of DEPENDENCY_NAME became a prefix for the _FOUND variable<br>=
=C2=A0 =C2=A0 find_package(cryptopp REQUIRED)<br>=C2=A0 =C2=A0 include_dire=
ctories(${CRYPTOPP_INCLUDE_DIRS})<br>=C2=A0 =C2=A0 link_libraries(${CRYPTOP=
P_LIBRARIES})<br>endif()<br>add_executable(${target_prefix}${scratch_name} =
"fanetex.cc")<br>target_link_libraries(${target_prefix}${scratch_=
name} PRIVATE cryptopp)<br><br>can you help me to solve this problem ? Than=
k you=C2=A0<img alt=3D"Capture d=E2=80=99=C3=A9cran 2024-04-17 114345.png" =
width=3D"631px" height=3D"398px" src=3D"https://groups.google.com/group/cry=
ptopp-users/attach/1f8b7a2cdb789/Capture%20d%E2%80%99%C3%A9cran%202024-04-1=
7%20114345.png?part=3D0.1&view=3D1"><br><br><div class=3D"gmail_quote">=
<div dir=3D"auto" class=3D"gmail_attr">Le mardi 16 avril 2024 =C3=A0 21:53:=
22 UTC-5, Frank Sapone a =C3=A9crit=C2=A0:<br></div><blockquote class=3D"gm=
ail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,=
204,204);padding-left:1ex">I grabbed it but it's not relevant.=C2=A0 I =
need to have a certificate with RSA PSS that can be read by CryptoPP with t=
he X509Cert lib.=C2=A0 Is it possible to do this?<br><br><div class=3D"gmai=
l_quote"><div dir=3D"auto" class=3D"gmail_attr">On Tuesday, April 16, 2024 =
at 3:19:47=E2=80=AFPM UTC-4 Jeffrey Walton wrote:<br></div><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid r=
gb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_quot=
e"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, Apr 16, 2024 at 1:44=E2=80=
=AFPM One Sini <<a rel=3D"nofollow">[email protected]</a>> wrote:<br><=
/div></div></div><div dir=3D"ltr"><div class=3D"gmail_quote"><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid=
rgb(204,204,204);padding-left:1ex"><div dir=3D"auto"><div><span style=3D"f=
ont-family:s=C3=B6hne,ui-sans-serif,system-ui,-apple-system,"segoe ui&=
quot;,roboto,ubuntu,cantarell,"noto sans",sans-serif,"helvet=
ica neue",arial,"apple color emoji","segoe ui emoji&quo=
t;,"segoe ui symbol","noto color emoji";font-size:16px;=
font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;tex=
t-transform:none;white-space:pre-wrap;word-spacing:0px;text-decoration:none=
;float:none;display:inline;color:rgb(13,13,13)">I wasn't entirely satis=
fied with the security, so I've adjusted the code. I'm not sure if =
that helps you, depending on what you're doing with it.</span></div><br=
></div></blockquote></div></div><div dir=3D"ltr"><div class=3D"gmail_quote"=
><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border=
-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"auto"><div><=
span style=3D"font-family:s=C3=B6hne,ui-sans-serif,system-ui,-apple-system,=
"segoe ui",roboto,ubuntu,cantarell,"noto sans",sans-ser=
if,"helvetica neue",arial,"apple color emoji","seg=
oe ui emoji","segoe ui symbol","noto color emoji";=
font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;text=
-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;text-=
decoration:none;float:none;display:inline;color:rgb(13,13,13)">This code us=
es RSA with OAEP (Optimal Asymmetric Encryption Padding) to avoid security =
issues like padding oracle attacks. It generates RSA keys with a length of =
2048 bits, encrypts the message with OAEP padding, and then decrypts it.</s=
pan></div><div dir=3D"auto"><span style=3D"font-family:s=C3=B6hne,ui-sans-s=
erif,system-ui,-apple-system,"segoe ui",roboto,ubuntu,cantarell,&=
quot;noto sans",sans-serif,"helvetica neue",arial,"appl=
e color emoji","segoe ui emoji","segoe ui symbol",=
"noto color emoji";font-size:16px;font-style:normal;font-weight:4=
00;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:pr=
e-wrap;word-spacing:0px;text-decoration:none;float:none;display:inline;colo=
r:rgb(13,13,13)"><br></span></div></div></blockquote></div></div><div dir=
=3D"ltr"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex"><div dir=3D"auto"><div dir=3D"auto"><span style=3D"font-family:s=
=C3=B6hne,ui-sans-serif,system-ui,-apple-system,"segoe ui",roboto=
,ubuntu,cantarell,"noto sans",sans-serif,"helvetica neue&quo=
t;,arial,"apple color emoji","segoe ui emoji","seg=
oe ui symbol","noto color emoji";font-size:16px;font-style:n=
ormal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:=
none;white-space:pre-wrap;word-spacing:0px;text-decoration:none;float:none;=
display:inline;color:rgb(13,13,13)">Best Regards Satoshi </span></div></div=
></blockquote><div><br></div><div>I deleted the message from the group. The=
*.pdf and *.pages smells of malware.</div><div><br></div><div>If you want =
to provide code, please inline it or provide it as a text attachment.<br></=
div><div><br></div><div>Jeff</div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex"><div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote=
" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);=
padding-left:1ex">
</blockquote></div></div></blockquote></div></div>
</blockquote></div></blockquote></div></blockquote></div>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;Crypto++ Users" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href data-email-masked rel=3D"nofollow">cryptopp-user...@googleg=
roups.com</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msgid/cryptopp-users/db9bad9f-be9e-4a25-a09f-d52ce28adec0n%40googlegro=
ups.com?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank" rel=
=3D"nofollow" data-saferedirecturl=3D"https://www.google.com/url?hl=3Den&am=
p;q=3Dhttps://groups.google.com/d/msgid/cryptopp-users/db9bad9f-be9e-4a25-a=
09f-d52ce28adec0n%2540googlegroups.com?utm_medium%3Demail%26utm_source%3Dfo=
oter&source=3Dgmail&ust=3D1714136079669000&usg=3DAOvVaw1AjOQy1Z=
gv1aJWlaxmb7f2">https://groups.google.com/d/msgid/cryptopp-users/db9bad9f-b=
e9e-4a25-a09f-d52ce28adec0n%40googlegroups.com</a>.<br>
</blockquote></div><br clear=3D"all"><div><br></div><span class=3D"gmail_si=
gnature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature"><d=
iv dir=3D"ltr"><div style=3D"text-align:left"><span style=3D"font-family:ar=
ial,sans-serif"><font color=3D"#9900ff">Kind Regards,=C2=A0</font></span></=
div><div style=3D"text-align:left"><font color=3D"#9900ff">Manish Kr. Sharm=
a=C2=A0</font></div><div style=3D"text-align:left"><font color=3D"#9900ff">=
Digital Marketing Manager<br></font></div><div style=3D"text-align:left"><f=
ont color=3D"#9900ff"><br></font></div><div style=3D"text-align:left"><span=
style=3D"color:rgb(153,0,255)">Website:=C2=A0</span><a href=3D"http://www.=
brsoftech.com" target=3D"_blank" rel=3D"nofollow" data-saferedirecturl=3D"h=
ttps://www.google.com/url?hl=3Den&q=3Dhttp://www.brsoftech.com&sour=
ce=3Dgmail&ust=3D1714136079669000&usg=3DAOvVaw2sTe3u-0mrGj170Bi1usu=
D">www.brsoftech.com</a><br></div><div style=3D"text-align:left"><font colo=
r=3D"#9900ff">E-mail: <a href data-email-masked rel=3D"nofollow">manish...@=
brsoftech.org</a></font></div><div style=3D"text-align:left"><img src=3D"ht=
tps://ci3.googleusercontent.com/proxy/1D62zxgVrHydF5cqqI0lanRFz5qesRSEOW4u_=
iI-RXcHTuxBfo_W_JCh-aJbWSCyoLU=3Ds0-d-e1-ft#https://i.imgur.com/ilarMcr.png=
" width=3D"96" height=3D"96"><br></div><div><br></div><div><br></div></div>=
</div>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;Crypto++ Users" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href data-email-masked rel=3D"nofollow">cryptopp-user...@googleg=
roups.com</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msgid/cryptopp-users/CABUB1NSTdFJPHBeh9b-fqfjrQBUWVzDzjNdjYUAQpzBb9CQs=
Zw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_=
blank" rel=3D"nofollow" data-saferedirecturl=3D"https://www.google.com/url?=
hl=3Den&q=3Dhttps://groups.google.com/d/msgid/cryptopp-users/CABUB1NSTd=
FJPHBeh9b-fqfjrQBUWVzDzjNdjYUAQpzBb9CQsZw%2540mail.gmail.com?utm_medium%3De=
mail%26utm_source%3Dfooter&source=3Dgmail&ust=3D1714136079669000&am=
p;usg=3DAOvVaw3SiTa5sTr9jE5AmP-ZuvD-">https://groups.google.com/d/msgid/cry=
ptopp-users/CABUB1NSTdFJPHBeh9b-fqfjrQBUWVzDzjNdjYUAQpzBb9CQsZw%40mail.gmai=
l.com</a>.<br>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;Crypto++ Users" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">cryp=
[email protected]</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msgid/cryptopp-users/18b7e58b-9c58-484f-8bed-69a63f8be39dn%40googlegro=
ups.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d=
/msgid/cryptopp-users/18b7e58b-9c58-484f-8bed-69a63f8be39dn%40googlegroups.=
com</a>.<br />
------=_Part_46517_1712383823.1714049941479--
------=_Part_46516_1190168352.1714049941479--