private byte[] padOAEP(byte[] M) throws BadPaddingException {
  if (random == null) {
    random=JCAUtil.getSecureRandom();
  }
  int hLen=lHash.length;
  byte[] seed=new byte[hLen];
  random.nextBytes(seed);
  byte[] EM=new byte[paddedSize];
  int seedStart=1;
  int seedLen=hLen;
  System.arraycopy(seed,0,EM,seedStart,seedLen);
  int dbStart=hLen + 1;
  int dbLen=EM.length - dbStart;
  int mStart=paddedSize - M.length;
  System.arraycopy(lHash,0,EM,dbStart,hLen);
  EM[mStart - 1]=1;
  System.arraycopy(M,0,EM,mStart,M.length);
  mgf1(EM,seedStart,seedLen,EM,dbStart,dbLen);
  mgf1(EM,dbStart,dbLen,EM,seedStart,seedLen);
  return EM;
}

private byte [ ] padOAEP ( byte [ ] M ) throws BadPaddingException { if ( random == null ) { random = JCAUtil . getSecureRandom ( ) ; } int hLen = lHash . length ; byte [ ] seed = new byte [ hLen ] ; random . nextBytes ( seed ) ; byte [ ] EM = new byte [ paddedSize ] ; int seedStart = 1 ; int seedLen = hLen ; System . arraycopy ( seed , 0 , EM , seedStart , seedLen ) ; int dbStart = hLen + 1 ; int dbLen = EM . length - dbStart ; int mStart = paddedSize - M . length ; System . arraycopy ( lHash , 0 , EM , dbStart , hLen ) ; EM [ mStart - 1 ] = 1 ; System . arraycopy ( M , 0 , EM , mStart , M . length ) ; mgf1 ( EM , seedStart , seedLen , EM , dbStart , dbLen ) ; mgf1 ( EM , dbStart , dbLen , EM , seedStart , seedLen ) ; return EM ; }
pkcs # 1 v2 . 0 oaep padding ( mgf1 ) . paragraph references refer to pkcs # 1 v2 . 1 ( june 14 , 2002 )
