OAEPEncoding class
RSAES-OAEP v2.0
This implementation is based on the RSAES-OAEP (RSA Encryption Scheme - Optimal Asymmetric Encryption Padding) as specified in section 7.1 of RFC 2437 PKCS #1: RSA Cryptography Specifications Version 2.0.
Important: this is not compatible with RSAES-OAEP v2.1 or later (as specified in RFC 3447, RFC 8017, etc.) Those newer versions have an extra 0x00 byte at the beginning of the encoded message (EM) that is passed to the RSA encryption primitive. Therefore, this implementation is incompatible with it, since this is an implementation of v2.0 which does not have that 0x00 byte. A breaking change in the standard!
Currently, this implementation has the following restrictions:
- the hash function is hard-coded to be SHA-1 or SHA-256;
- the mask generation function is hard-coded to MGF1; and
- it cannot accept any encoding parameters (that is, P is always empty)
- Implemented types
Constructors
- OAEPEncoding(AsymmetricBlockCipher engine, [Uint8List? encodingParams])
-
factory
- OAEPEncoding.withCustomDigest(DigestFactory digestFactory, AsymmetricBlockCipher engine, [Uint8List? encodingParams])
-
factory
- OAEPEncoding.withSHA1(AsymmetricBlockCipher engine, [Uint8List? encodingParams])
-
factory
- OAEPEncoding.withSHA256(AsymmetricBlockCipher engine, [Uint8List? encodingParams])
-
factory
Properties
- algorithmName → String
-
Get this algorithm's standard name.
no setteroverride
- defHash ↔ Uint8List
-
Default hash of the encoding parameters,
all zero octets
getter/setter pair
- encodingParams ↔ Uint8List?
-
The encoding params, or P, as specified in
RFC 2437
getter/setter pair
- hash ↔ Digest
-
Hash function used by the EME-OAEP (Encoding Method for Encryption OAEP).
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- inputBlockSize → int
-
Get this ciphers's maximum input block size.
no setteroverride
- mgf1Hash ↔ Digest
-
Hash function used by the MGF1 Mask Generation Function.
getter/setter pair
- outputBlockSize → int
-
Get this ciphers's maximum output block size.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
init(
bool forEncryption, CipherParameters params) → void -
Init the cipher with its initialization
params
. The type of CipherParameters depends on the algorithm being used (see the documentation of each implementation to find out more).override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
process(
Uint8List data) → Uint8List -
Process a whole block of
data
at once, returning the result in a byte array.inherited -
processBlock(
Uint8List inp, int inpOff, int len, Uint8List out, int outOff) → int -
Process a block of
len
bytes given byinp
and starting at offsetinpOff
and put the resulting cipher text inout
beginning at positionoutOff
.override -
reset(
) → void -
Reset the cipher to its original state.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- factoryConfig → FactoryConfig
-
Intended for internal use.
final