<s>
In	O
cryptography	O
,	O
Optimal	B-Algorithm
Asymmetric	I-Algorithm
Encryption	I-Algorithm
Padding	I-Algorithm
(	O
OAEP	B-Algorithm
)	O
is	O
a	O
padding	B-Algorithm
scheme	I-Algorithm
often	O
used	O
together	O
with	O
RSA	B-Architecture
encryption	I-Architecture
.	O
</s>
<s>
OAEP	B-Algorithm
was	O
introduced	O
by	O
Bellare	O
and	O
Rogaway	O
,	O
and	O
subsequently	O
standardized	O
in	O
PKCS	O
#1	O
v2	O
and	O
RFC	O
2437	O
.	O
</s>
<s>
The	O
OAEP	B-Algorithm
algorithm	O
is	O
a	O
form	O
of	O
Feistel	B-Algorithm
network	I-Algorithm
which	O
uses	O
a	O
pair	O
of	O
random	B-Application
oracles	I-Application
G	O
and	O
H	O
to	O
process	O
the	O
plaintext	O
prior	O
to	O
asymmetric	B-Application
encryption	I-Application
.	O
</s>
<s>
When	O
combined	O
with	O
any	O
secure	O
trapdoor	O
one-way	O
permutation	O
,	O
this	O
processing	O
is	O
proved	O
in	O
the	O
random	B-Application
oracle	I-Application
model	I-Application
to	O
result	O
in	O
a	O
combined	O
scheme	O
which	O
is	O
semantically	O
secure	O
under	O
chosen	O
plaintext	O
attack	O
(	O
IND-CPA	O
)	O
.	O
</s>
<s>
When	O
implemented	O
with	O
certain	O
trapdoor	O
permutations	O
(	O
e.g.	O
,	O
RSA	B-Architecture
)	O
,	O
OAEP	B-Algorithm
is	O
also	O
proven	O
to	O
be	O
secure	O
against	O
chosen	O
ciphertext	O
attack	O
.	O
</s>
<s>
OAEP	B-Algorithm
can	O
be	O
used	O
to	O
build	O
an	O
all-or-nothing	O
transform	O
.	O
</s>
<s>
OAEP	B-Algorithm
satisfies	O
the	O
following	O
two	O
goals	O
:	O
</s>
<s>
Add	O
an	O
element	O
of	O
randomness	O
which	O
can	O
be	O
used	O
to	O
convert	O
a	O
deterministic	O
encryption	O
scheme	O
(	O
e.g.	O
,	O
traditional	O
RSA	B-Architecture
)	O
into	O
a	O
probabilistic	O
scheme	O
.	O
</s>
<s>
The	O
original	O
version	O
of	O
OAEP	B-Algorithm
(	O
Bellare/Rogaway	O
,	O
1994	O
)	O
showed	O
a	O
form	O
of	O
"	O
plaintext	O
awareness	O
"	O
(	O
which	O
they	O
claimed	O
implies	O
security	O
against	O
chosen	O
ciphertext	O
attack	O
)	O
in	O
the	O
random	B-Application
oracle	I-Application
model	I-Application
when	O
OAEP	B-Algorithm
is	O
used	O
with	O
any	O
trapdoor	O
permutation	O
.	O
</s>
<s>
Subsequent	O
results	O
contradicted	O
this	O
claim	O
,	O
showing	O
that	O
OAEP	B-Algorithm
was	O
only	O
IND-CCA1	O
secure	O
.	O
</s>
<s>
However	O
,	O
the	O
original	O
scheme	O
was	O
proved	O
in	O
the	O
random	B-Application
oracle	I-Application
model	I-Application
to	O
be	O
IND-CCA2	O
secure	O
when	O
OAEP	B-Algorithm
is	O
used	O
with	O
the	O
RSA	B-Architecture
permutation	O
using	O
standard	O
encryption	O
exponents	O
,	O
as	O
in	O
the	O
case	O
of	O
RSA-OAEP	B-Algorithm
.	O
</s>
<s>
An	O
improved	O
scheme	O
(	O
called	O
OAEP+	O
)	O
that	O
works	O
with	O
any	O
trapdoor	O
one-way	O
permutation	O
was	O
offered	O
by	O
Victor	O
Shoup	O
to	O
solve	O
this	O
problem	O
.	O
</s>
<s>
More	O
recent	O
work	O
has	O
shown	O
that	O
in	O
the	O
standard	B-General_Concept
model	I-General_Concept
(	O
that	O
is	O
,	O
when	O
hash	B-Algorithm
functions	I-Algorithm
are	O
not	O
modeled	O
as	O
random	B-Application
oracles	I-Application
)	O
it	O
is	O
impossible	O
to	O
prove	O
the	O
IND-CCA2	O
security	O
of	O
RSA-OAEP	B-Algorithm
under	O
the	O
assumed	O
hardness	O
of	O
the	O
RSA	B-Architecture
problem	O
.	O
</s>
<s>
Hash	B-Algorithm
is	O
the	O
chosen	O
hash	B-Algorithm
function	I-Algorithm
,	O
</s>
<s>
hLen	O
is	O
the	O
length	O
of	O
the	O
output	O
of	O
the	O
hash	B-Algorithm
function	I-Algorithm
in	O
bytes	O
,	O
</s>
<s>
k	O
is	O
the	O
length	O
of	O
the	O
RSA	B-Architecture
modulus	O
n	O
in	O
bytes	O
,	O
</s>
<s>
RFC	O
8017	O
for	O
PKCS	O
#1	O
v2.2	O
specifies	O
the	O
OAEP	B-Algorithm
scheme	O
as	O
follows	O
for	O
encoding	O
:	O
</s>
<s>
Hash	B-Algorithm
the	O
label	O
L	O
using	O
the	O
chosen	O
hash	B-Algorithm
function	I-Algorithm
:	O
</s>
<s>
Generate	O
a	O
padding	B-Algorithm
string	O
PS	O
consisting	O
of	O
bytes	O
with	O
the	O
value	O
0x00	O
.	O
</s>
<s>
Hash	B-Algorithm
the	O
label	O
L	O
using	O
the	O
chosen	O
hash	B-Algorithm
function	I-Algorithm
:	O
</s>
<s>
If	O
any	O
of	O
these	O
conditions	O
are	O
n't	O
met	O
,	O
then	O
the	O
padding	B-Algorithm
is	O
invalid	O
.	O
</s>
<s>
Usage	O
in	O
RSA	B-Architecture
:	O
The	O
encoded	O
message	O
can	O
then	O
be	O
encrypted	O
with	O
RSA	B-Architecture
.	O
</s>
<s>
The	O
deterministic	O
property	O
of	O
RSA	B-Architecture
is	O
now	O
avoided	O
by	O
using	O
the	O
OAEP	B-Algorithm
encoding	O
because	O
the	O
seed	O
is	O
randomly	O
generated	O
and	O
influences	O
the	O
entire	O
encoded	O
message	O
.	O
</s>
<s>
Since	O
any	O
changed	O
bit	O
of	O
a	O
cryptographic	B-Algorithm
hash	I-Algorithm
completely	O
changes	O
the	O
result	O
,	O
the	O
entire	O
maskedDB	O
,	O
and	O
the	O
entire	O
maskedSeed''	O
must	O
both	O
be	O
completely	O
recovered	O
.	O
</s>
<s>
In	O
the	O
PKCS	O
#1	O
standard	O
,	O
the	O
random	B-Application
oracles	I-Application
are	O
identical	O
.	O
</s>
<s>
The	O
PKCS	O
#1	O
standard	O
further	O
requires	O
that	O
the	O
random	B-Application
oracles	I-Application
be	O
MGF1	O
with	O
an	O
appropriate	O
hash	B-Algorithm
function	I-Algorithm
.	O
</s>
