• Hello Team
    why is the encrypted payload length longer when passed trough URL than without redirecting to URL? I see the one which is passed in URL contains some whitespaces

    Encrypted Payload: kXIZkw4KPF PTkjVXUn /WeZYU0lkj1PkfiM7tHt5LX9ojBXdhYDwVIfdSLN6m90fGiVezKC82vfSTgeUZPRoFCEJuhMiaXiYNT67GyGnPfO84Kfzc7bhCyBhQEdHEZjvwqLylXYNn jxV383fWcmvIXQvpUTTVYqrQrYSAgkvmS6OdqLghc Y6HiGk0B1BYF o4Rb90ZIrtfrmt7Euk0KEUh18wdvVo htXimsijN NERpLlQpFG6R5mdcMw7VcGUZTpwY1wbKFylZ7JZAzMaXsaioCt78cyPMRdwTS4fST7M6WUf1SuI2gAvtKLrWkFwhXOs9y9xVk7qumtTyAdEk CjUVnzNl94asNOcdexxOEdQbxevdIYsxyjwCcxjim4RUloc6A5B32pO4wcgSk2RJgK45n2fx0Cv2SbZYCX Qei5carDjO/fezmzpGc/atME7QypGVj mKhNqwPnDfV0b6JJafm4zIFeVZF3gNhs1b5k pEu2iw2WWOgZLM8y3cPchSf8kiCiwpjiHST/i dO8m cUDWO/nTXRsUQipqx4b7wGQJ7L7Svtjn72PWz58mFiUps1rOmxL8V8HD1As8PAEARd5oNoP0yktLohNtUpnKCcqXb03Af5ed494D1oova/TnOHwrZwwBrycYNl4HfreL5Cc33/ujAMFb6rlc=
    correct one:
    Encrypted Payload: Yx6F8KHC2X5A3PdDnWBzrWKoxvvYTe27guPQ8qwNizkMA84ODv7pXSBjqc7N2VC4eGCxKVord6kOenwRcpg9RhEXgyb4lmmYjikdvJG0NQMe+HTgX4FGezqMLrbMKd8B1eJoTf3aAvInWSuiAkFXVuvbBnJXS+H3kasWH+n4BvYe6JDmEm2Pqbj1lcRVnG21GCc2Agc+V/UCxM7PZcj9smcmSPcj/DCFigrNzhmRaTuHqG/9zoxsD1HONweEpEoV617nPWN+mmYTen1cXvPA6orprpGYvhpNYpBCShenb/M0mdx+ALEn0CufbtXABYLEDnpIo3VYhqkGp+5Gc1OX/CWed+q1pD0ez1DJRsovvFk56phCPCWP5rPfmJuelKEuSZb6VmrsGc67Fj/unE1RHzhttxG8+s1wMd0mhPGbmIFrSbzxU+tqNdJV3+I3RKTOgaV9vInUWt/peIHe/nMkYmOg20K9FAOdHHsAHGJHOa9HDJKBxbivPLf58pQ0gAuHJjfjgSL1yJuHNyHoupaCuwh0jom5+TYozgf9seAcEXHgtOE7qbYTmQ4AolX5tYxyUMFj1kGvnAakHb55iLf4fhpEduHri4KX3bbzmhn14R0ssuW32wAeQ+DyHK2AkgEDPyVlXPYubvXmrdbvKxyJYvfKApdrBLDMcS5a/NeXFQg=
    the code to generate the encrypted payload is same
    $rsa = new \phpseclib\Crypt\RSA();
    $rsa->setHash( 'sha1' );
    $rsa->setMGFHash( 'sha1' );
    $rsa->setEncryptionMode( RSA::ENCRYPTION_OAEP );
    $rsa->setPublicKeyFormat(RSA::PUBLIC_FORMAT_PKCS1);
    $rsa->loadKey($publicKey); // public key
    $encryptedPayload = base64_encode($rsa->encrypt($payload)); (edited) 

    Thanks,

    Roshan

    • This topic was modified 2 years, 4 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Base64 encoding is always going to be longer than the raw binary input, that’s how it works. You cannot pass binary data in an URL, it has to be re-encoded somehow. Whitespaces are not part of Base64 output. I’ve no idea how or why they are introduced. Some added processing is being done somewhere. It wouldn’t matter if the receiving end can properly account for them.

Viewing 1 replies (of 1 total)
  • The topic ‘encryption’ is closed to new replies.