Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Add PKCS#7 padding

by Anonymous Monk
on Dec 17, 2013 at 19:26 UTC ( #1067515=note: print w/ replies, xml ) Need Help??


in reply to Add PKCS#7 padding

PKCS#7 padding is just a generalization of PCKS#5 padding to allow for block sizes other than 8 bytes. I don't the padding is the problem.


Comment on Re: Add PKCS#7 padding
Re^2: Add PKCS#7 padding
by burgerc (Novice) on Dec 17, 2013 at 21:07 UTC
    A .net server is doing the decrypting and it specifies that it must be pkcs#7. I understand there should be no difference, and my program can decrypt my string and the .net string, however .net can not. Probably doesn't mean anything but here are the two encrypted strings.

    .net with pkcs#7 - Toi0YpovwX79oXK105RzcH28XjJoxy8Y2q+R1LHyNiw=

    perl with pkcs#5 - KBjT88Hk9MBtacub+xT54g==

    both of these decrypt to the same string.

    If I'm wrong please let me know.

    I appreciate your help Chris

      So... any idea why the .net version is twice as long? Are you sure your perl script decodes them both to the same thing? Have you tried printing the result with MIME::QuotedPrint to see if there are any weird nonprinting characters in there?
        I do not know why it is twice as long. They do decrypt to the same string. I will print with MIME::QuotedPrint to see what I get with that. Thanks
        I have fixed the problem. .net (microsoft) considers unicode to be utf16 not utf8. Once I converted my string to utf16 the encryption worked fine.

        Crazy microsoft.

        thanks for all your help in this. I have updated my initial code to show the utf16 encoding so this may help others in the future. I did notice that UTF16 did not work but UTF16le did. Not sure what the difference is.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1067515]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2014-09-20 23:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (163 votes), past polls