Forum Archive

How to perform OAEP padding on plaintext?

vamsipriya

I'm examining RSA cryptosystem by reproducing it. I realize that cushioning is basic for security of figure, subsequently i've picked PKCS1 OAEP cushioning since it's a standout amongst the most secure techniques for cushioning message. I couldn't discover correct just justifiable hotspot for performing OAEP cushioning from my exploration.

message = "Hello World"
message_length = len(message) # value: 11
hash = sha1("").hexdigest() # value: "da39a3ee5e6b4b0d3255bfef95601890afd80709"
hash_length = len(hash) # value: 40
mod_size = (66707621741034658424514206418677753964865266688022969048429208771289785288847727334295743540860932900769628607474618294659295004562698532947535801821428015940719336654123007538255459184765551631213180128939808032261346408111382837800099426844454970753309552867519518744723276317986718923680385211621637413963).bit_length() # size of public modulus (value: 1023)
mod_size_bytes = -(-mod_size//8) # size of public modulus in bytes, using ceil division

reticulated

@vamsipriya said:

PKCS1 OAEP

Hi there,

I've personally never tried implementing myself, but I figured a reference may help.

https://github.com/bdauvergne/python-pkcs1

The readme mentions external dependencies for performance gains but id imagine you could find something to work with there.

Hope it helps..

omz

@reticulated Just fyi, the OP is likely spam (copied verbatim from StackOverflow), but I'll leave this here in case your answer is useful to someone.

dgelessus

It seems like most of the recent spam posts don't have any links in the posts themselves - instead they have them in the poster's profile. Unfortunately the forum software has no way to report users themselves, so I have to report the posts instead.