Top Description Fields Constructors Methods
sun.security.rsa

public final Class MGF1

extends Object
Class Inheritance
Imports
java.security.*

This class implements the MGF1 mask generation function defined in PKCS#1 v2.2 B.2.1 (https://tools.ietf.org/html/rfc8017#appendix-B.2.1). A mask generation function takes an octet string of variable length and a desired output length as input and outputs an octet string of the desired length. MGF1 is a mask generation function based on a hash function, i.e. message digest algorithm.
Since
11

Field Summary

Modifier and TypeField and Description
private final MessageDigest

Constructor Summary

AccessConstructor and Description
pack-priv
MGF1(String mdAlgo)

Construct an instance of MGF1 based on the specified digest algorithm.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
generateAndXor(byte[]
the buffer holding the seed bytes
seed
,
int
the index of the seed bytes
seedOfs
,
int
the length of the seed bytes to be used by MGF1
seedLen
,
int
the intended length of the generated mask
maskLen
,
byte[]
the output buffer holding the mask
out
,
int
the index of the output buffer for the mask
outOfs
)

Using the specified seed bytes, generate the mask, xor the mask with the specified output buffer and store the result into the output buffer (essentially replaced in place).

pack-priv String
getName()

Returns the name of this MGF1 instance, i.e. "MGF1" followed by the digest algorithm it based on.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mdback to summary
private final MessageDigest md

Constructor Detail

MGF1back to summary
pack-priv MGF1(String mdAlgo) throws NoSuchAlgorithmException

Construct an instance of MGF1 based on the specified digest algorithm.

Method Detail

generateAndXorback to summary
pack-priv void generateAndXor(byte[] seed, int seedOfs, int seedLen, int maskLen, byte[] out, int outOfs) throws RuntimeException

Using the specified seed bytes, generate the mask, xor the mask with the specified output buffer and store the result into the output buffer (essentially replaced in place).

Parameters
seed:byte[]

the buffer holding the seed bytes

seedOfs:int

the index of the seed bytes

seedLen:int

the length of the seed bytes to be used by MGF1

maskLen:int

the intended length of the generated mask

out:byte[]

the output buffer holding the mask

outOfs:int

the index of the output buffer for the mask

getNameback to summary
pack-priv String getName()

Returns the name of this MGF1 instance, i.e. "MGF1" followed by the digest algorithm it based on.