{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
DEROutputStream dOut = new DEROutputStream(bOut);
AlgorithmIdentifier hashAlgorithm = new AlgorithmIdentifier(
JCEDigestUtil.getOID(currentSpec.getDigestAlgorithm()),
new DERNull());
MGF1ParameterSpec mgfSpec = (MGF1ParameterSpec)currentSpec.getMGFParameters();
AlgorithmIdentifier maskGenAlgorithm = new AlgorithmIdentifier(
PKCSObjectIdentifiers.id_mgf1,
new AlgorithmIdentifier(JCEDigestUtil.getOID(mgfSpec.getDigestAlgorithm()), new DERNull()));
PSource.PSpecified pSource = (PSource.PSpecified)currentSpec.getPSource();
AlgorithmIdentifier pSourceAlgorithm = new AlgorithmIdentifier(
PKCSObjectIdentifiers.id_pSpecified, new DEROctetString(pSource.getValue()));
RSAESOAEPparams oaepP = new RSAESOAEPparams(hashAlgorithm, maskGenAlgorithm, pSourceAlgorithm);