public class LunaRSAOAEPEncoder
extends java.lang.Object
Constructor and Description |
---|
LunaRSAOAEPEncoder() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
decodeOAEP(byte[] encodedMessage,
int encodedMessageOffset,
int encodedMessageLength,
int keySize,
byte[] encodedParams)
Decodes encodedMessage using RSA OAEP decoding and returns message.
|
static byte[] |
encodeOAEP(byte[] message,
int messageOffset,
int messageLength,
int keySizeBytes,
byte[] encodedParams,
byte[] seed)
Encodes a message using RSA OAEP Padding.
|
static java.security.MessageDigest |
getMessageDigestFromParams(byte[] encodedParams)
Gets appropriate MessageDigest by reading the hashing algorithm by decoding the encodedParams
that come from
LunaParametersOAEP.engineGetEncoded() }. |
static byte[] |
getSourceDataFromParams(byte[] encodedParams)
Gets encoded source data by decoding the encodedParams
that come from
LunaParametersOAEP.engineGetEncoded() }. |
static byte[] |
mgf(byte[] seed,
int seedOffset,
int seedLength,
int expectedLength,
java.security.MessageDigest digest)
Performs The Mask Generation Function (MGF) to create a mask using specified seed.
|
public static byte[] mgf(byte[] seed, int seedOffset, int seedLength, int expectedLength, java.security.MessageDigest digest)
seed
- The seed to use for the MGFseedOffset
- The offset into the seed byte arrayseedLength
- The length in bytes of the seedexpectedLength
- The expected length of the returned maskdigest
- The MessageDigest to use for the Hash functionpublic static java.security.MessageDigest getMessageDigestFromParams(byte[] encodedParams)
LunaParametersOAEP.engineGetEncoded()
}.encodedParams
- the encodedParams to decodepublic static byte[] getSourceDataFromParams(byte[] encodedParams)
LunaParametersOAEP.engineGetEncoded()
}.encodedParams
- the encodedParams to decodepublic static byte[] encodeOAEP(byte[] message, int messageOffset, int messageLength, int keySizeBytes, byte[] encodedParams, byte[] seed)
message
- The message to encodemessageOffset
- Offset index of the message byte arraymessageLength
- The length of the message. Must be <= keySizeBytes - 2 * hLen - 2 where hLen is the length in bytes of hashes
from the Hashing algorithm.keySizeBytes
- The size in bytes of the the RSA keyencodedParams
- The encoded params that come from LunaParametersOAEP.engineGetEncoded()
}seed
- The seed to use for the algorithm. If null or the length of the seed doesn't match hLen, seed is generated.public static byte[] decodeOAEP(byte[] encodedMessage, int encodedMessageOffset, int encodedMessageLength, int keySize, byte[] encodedParams)
encodedMessage
- the encodedMessage to decodeencodedMessageOffset
- the offset into the encodedMessageencodedMessageLength
- the length of the encodedMessagekeySize
- the key size in bytesencodedParams
- The encoded params that come from LunaParametersOAEP.engineGetEncoded()
}Copyright 2014-2018 SafeNet. All rights reserved.