Obviously, I don't know how to do the actual decryption of the security field. :)use Some_RSA_Module; use Digest::MD5 qw/ md5 /; # decode base64 as before, then: my $encrypted = substr($cookie, -64); substr($cookie, -65) = ''; # strip the null and the security fiel +d my $checksum = Some_RSA_Module::unencrypt($some_public_key, $encrypted +); my $new_checksum = md5($cookie); if ($new_checksum eq $checksum) { print "Checksums match, cookie data is valid.\n"; } else { print "Checksums don't match, cookie data has been tampered with.\n" +; }
The other question is how the md5 hash is being generated; they could be used md5_base64 or md5_hex instead of plain md5. The length of the decrypted checksum will tell you which...
I used substr() to get the security field, instead of splitting on nulls, because I was cautioned in the CB that the security field might contain embedded nulls itself. :)
In reply to Re: Re: Re: Base64 Encoded cookie is giving me headaches!
by chipmunk
in thread Base64 Encoded cookie is giving me headaches!
by tame1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |