I perform an operation on several strings in a Python function and return the final value with the name of the result I use the result value in another file to encrypt or sign with the RSA algorithm The problem is that the output of the algorithm is different when I give it directly to RSA and when I put it as a string between two "" while the null data of both is STR
x= rsa_encrypt(result) # result = good book
print(x)
type(result) # str
out put is :
H63Lc1x0592lBXVt0vQrNJbkNdbbnvvLc4jdyavFcpymJCowhnMvt09b9CFqm1evut0jb4IS9bC/AGKVQ/+OAJmFVbDQDMCyqeHJq7HoHZiGCrFnWWHF7aH3b6Mqit195z22RtL2SYQ1fZeaXn8vYX6Gqavp7U8YAG8fQj1GB+Pi7Pg+WHtxa4Ic/v5FE3yu9O1aGT6SdwEgNDK+ePpVzkQPxFdAx+sPJ0+F4QRFmCSS/rKi0mnDG5LANCzX8RYZoMK7O5ScH9Pz1B2+Fxo2srYK7dmTg+QnKdmvtnHMaxO5OUX0NjOtDTHJN316hTkD85jsdDqj6XF3I9W/UF1lDg==
y="good book"
x= rsa_encrypt(y)
print(x)
type(y) # str
out put is :
nfUz238vHq3Hhpghk6tsyLsNpa4BbVym50Hi/YV6KcDwP1Y4GxVLg0S8eCmXUqIeOq7qR+Ug+0MSFaM/nVvxcGn3qPYJJzBlKRl0/tbW7wGtvP1IZO6VQCwA8awr12TRUMAchrWZX9628UOge62jpqAjRCPA9ZARxEjh8YTkSfiIOva+PbPwAECDjXbj+FcuSzSP2W5Qa3b6UnfUfIUPpzIP+PCbxXTJ9QxYoiu7JJxrhO3M3pxvBhy6y8KCMyqkVzNhLSSIxL6skyr1V0srdIgMy+pmPTHUXRoNlqEWz6TSfKas1BNxFlHjpprw98La0xqzHN5Kkoc8g5qPBN//QQ==
My additional point:
I use the RSA algorithm for signing "RSASSA-PKCS1-v1_5". To sign and use this algorithm, I need to put my own string that I want to be signed.
I have no problem with the RSA algorithm, I have a problem with the string I want to sign
The problem is that my string is directly entered from another function to be signed with the RSA algorithm, and that is why my signed string is different from when I enter the input string manually and between double quotes
for signing. I give RSA to the algorithm
For example, the output of my function that I give directly to the RSA algorithm for signing is this
This is a test entry
When this value is given to the RSA algorithm, it returns me an encrypted string
But if the string
This is a test entry
I enter it in the format "This is a test input"
, between the two double quotes
, the RSA algorithm gives me another string.
The point is, I need my string to be signed between double quotes, but not manually, but automatically
So, in general, I need to automatically give the RSA algorithm the format of my function, which is a string, inside double quotes.