Program: 52450
Project: 52450
Buggy source:
public void performTest() throws Exception {
  KeyFactory fact;
  byte[] input=new byte[]{(byte)0x54,(byte)0x85,(byte)0x9b,(byte)0x34,(byte)0x2c,(byte)0x49,(byte)0xea,(byte)0x2a};
  byte[][] output=new byte[][]{Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str")};
  SecureRandom rand=new FixedSecureRandom();
  fact=KeyFactory.getInstance("String_Node_Str","String_Node_Str");
  PrivateKey privKey=fact.generatePrivate(privKeySpec);
  PublicKey pubKey=fact.generatePublic(pubKeySpec);
  PrivateKey priv2048Key=fact.generatePrivate(priv2048KeySpec);
  PublicKey pub2048Key=fact.generatePublic(pub2048KeySpec);
  PrivateKeyInfo keyInfo=PrivateKeyInfo.getInstance(privKey.getEncoded());
  BigInteger zero=BigInteger.valueOf(0);
  PKCS8EncodedKeySpec noCrtSpec=new PKCS8EncodedKeySpec(new PrivateKeyInfo(keyInfo.getPrivateKeyAlgorithm(),new org.bouncycastle.asn1.pkcs.RSAPrivateKey(privKeySpec.getModulus(),privKeySpec.getPublicExponent(),privKeySpec.getPrivateExponent(),zero,zero,zero,zero,zero)).getEncoded());
  PrivateKey noCrtKey=fact.generatePrivate(noCrtSpec);
  if (noCrtKey instanceof RSAPrivateCrtKey) {
    fail("String_Node_Str");
  }
  Cipher c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  byte[] out=c.doFinal(input);
  if (!areEqual(out,output[0])) {
    fail("String_Node_Str" + new String(Hex.encode(output[0])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  c.update(input);
  out=c.doFinal();
  if (!areEqual(out,output[0])) {
    fail("String_Node_Str" + new String(Hex.encode(output[0])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  c.update(input);
  out=c.doFinal();
  if (!areEqual(out,output[0])) {
    fail("String_Node_Str" + new String(Hex.encode(output[0])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  byte[] modBytes=((RSAPublicKey)pubKey).getModulus().toByteArray();
  byte[] maxInput=new byte[modBytes.length - 1];
  maxInput[0]|=0x7f;
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.doFinal(maxInput);
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,maxInput)) {
    fail("String_Node_Str" + new String(Hex.encode(maxInput)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[1])) {
    fail("String_Node_Str" + new String(Hex.encode(output[1])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[1])) {
    fail("String_Node_Str" + new String(Hex.encode(output[1])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[2])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  AlgorithmParameters oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new RSAESOAEPparams(new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1,DERNull.INSTANCE),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1,new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1,DERNull.INSTANCE)),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_pSpecified,new DEROctetString(new byte[0]))).getEncoded())) {
    fail("String_Node_Str");
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pub2048Key,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[3])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,priv2048Key);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new RSAESOAEPparams(new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224,DERNull.INSTANCE),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1,new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224,DERNull.INSTANCE)),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_pSpecified,new DEROctetString(new byte[0]))).getEncoded())) {
    fail("String_Node_Str");
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pub2048Key,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[4])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,priv2048Key);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new RSAESOAEPparams(new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256,DERNull.INSTANCE),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1,new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256,DERNull.INSTANCE)),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_pSpecified,new DEROctetString(new byte[0]))).getEncoded())) {
    fail("String_Node_Str");
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pub2048Key,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[5])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,priv2048Key);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new RSAESOAEPparams(new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha384,DERNull.INSTANCE),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1,new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha384,DERNull.INSTANCE)),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_pSpecified,new DEROctetString(new byte[0]))).getEncoded())) {
    fail("String_Node_Str");
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[6])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new RSAESOAEPparams(new AlgorithmIdentifier(PKCSObjectIdentifiers.md5,DERNull.INSTANCE),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1,new AlgorithmIdentifier(PKCSObjectIdentifiers.md5,DERNull.INSTANCE)),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_pSpecified,new DEROctetString(new byte[0]))).getEncoded())) {
    fail("String_Node_Str");
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,OAEPParameterSpec.DEFAULT,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[2])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new byte[]{0x30,0x00})) {
    fail("String_Node_Str");
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,new OAEPParameterSpec("String_Node_Str","String_Node_Str",new MGF1ParameterSpec("String_Node_Str"),new PSource.PSpecified(new byte[]{1,2,3,4,5})),rand);
  out=c.doFinal(input);
  oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new RSAESOAEPparams(new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1,DERNull.INSTANCE),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1,new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1,DERNull.INSTANCE)),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_pSpecified,new DEROctetString(new byte[]{1,2,3,4,5}))).getEncoded())) {
    fail("String_Node_Str");
  }
  if (!areEqual(out,output[7])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.DECRYPT_MODE,privKey,oaepP);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  byte[] isoInput=Hex.decode("String_Node_Str");
  PrivateKey isoPrivKey=fact.generatePrivate(isoPrivKeySpec);
  PublicKey isoPubKey=fact.generatePublic(isoPubKeySpec);
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,isoPrivKey);
  out=c.doFinal(isoInput);
  if (!areEqual(out,output[8])) {
    fail("String_Node_Str" + new String(Hex.encode(output[3])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,isoPubKey);
  out=c.doFinal(out);
  if (!areEqual(out,isoInput)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  KeyPairGenerator keyPairGen=KeyPairGenerator.getInstance("String_Node_Str","String_Node_Str");
  keyPairGen.initialize(new RSAKeyGenParameterSpec(768,BigInteger.valueOf(65537)),new SecureRandom());
  KeyPair kp=keyPairGen.generateKeyPair();
  pubKey=kp.getPublic();
  privKey=kp.getPrivate();
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.doFinal(input);
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  KeyFactory keyFact=KeyFactory.getInstance("String_Node_Str","String_Node_Str");
  RSAPrivateCrtKey crtKey=(RSAPrivateCrtKey)keyFact.translateKey(privKey);
  if (!privKey.equals(crtKey)) {
    fail("String_Node_Str");
  }
  crtKey=(RSAPrivateCrtKey)keyFact.generatePrivate(new PKCS8EncodedKeySpec(privKey.getEncoded()));
  if (!privKey.equals(crtKey)) {
    fail("String_Node_Str");
  }
  crtKey=(RSAPrivateCrtKey)serializeDeserialize(privKey);
  if (!privKey.equals(crtKey)) {
    fail("String_Node_Str");
  }
  if (privKey.hashCode() != crtKey.hashCode()) {
    fail("String_Node_Str");
  }
  RSAPublicKey copyKey=(RSAPublicKey)keyFact.translateKey(pubKey);
  if (!pubKey.equals(copyKey)) {
    fail("String_Node_Str");
  }
  copyKey=(RSAPublicKey)keyFact.generatePublic(new X509EncodedKeySpec(pubKey.getEncoded()));
  if (!pubKey.equals(copyKey)) {
    fail("String_Node_Str");
  }
  copyKey=(RSAPublicKey)serializeDeserialize(pubKey);
  if (!pubKey.equals(copyKey)) {
    fail("String_Node_Str");
  }
  if (pubKey.hashCode() != copyKey.hashCode()) {
    fail("String_Node_Str");
  }
  SubjectPublicKeyInfo oaepKey=new SubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.id_RSAES_OAEP,new RSAESOAEPparams()),SubjectPublicKeyInfo.getInstance(pubKey.getEncoded()).parsePublicKey());
  copyKey=(RSAPublicKey)serializeDeserialize(keyFact.generatePublic(new X509EncodedKeySpec(oaepKey.getEncoded())));
  if (!pubKey.equals(copyKey)) {
    fail("String_Node_Str");
  }
  if (pubKey.hashCode() != copyKey.hashCode()) {
    fail("String_Node_Str");
  }
  if (!Arrays.areEqual(copyKey.getEncoded(),oaepKey.getEncoded())) {
    fail("String_Node_Str");
  }
  oaepCompatibilityTest("String_Node_Str",priv2048Key,pub2048Key);
  oaepCompatibilityTest("String_Node_Str",priv2048Key,pub2048Key);
  oaepCompatibilityTest("String_Node_Str",priv2048Key,pub2048Key);
  oaepCompatibilityTest("String_Node_Str",priv2048Key,pub2048Key);
  SecureRandom random=new SecureRandom();
  rawModeTest("String_Node_Str",X509ObjectIdentifiers.id_SHA1,priv2048Key,pub2048Key,random);
  rawModeTest("String_Node_Str",PKCSObjectIdentifiers.md5,priv2048Key,pub2048Key,random);
  rawModeTest("String_Node_Str",TeleTrusTObjectIdentifiers.ripemd128,priv2048Key,pub2048Key,random);
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.update(new byte[40]);
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.update(new byte[40]);
}

Fixed version (ground truth):
public void performTest() throws Exception {
  KeyFactory fact;
  byte[] input=new byte[]{(byte)0x54,(byte)0x85,(byte)0x9b,(byte)0x34,(byte)0x2c,(byte)0x49,(byte)0xea,(byte)0x2a};
  byte[][] output=new byte[][]{Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str"),Hex.decode("String_Node_Str")};
  SecureRandom rand=new FixedSecureRandom();
  fact=KeyFactory.getInstance("String_Node_Str","String_Node_Str");
  PrivateKey privKey=fact.generatePrivate(privKeySpec);
  PublicKey pubKey=fact.generatePublic(pubKeySpec);
  PrivateKey priv2048Key=fact.generatePrivate(priv2048KeySpec);
  PublicKey pub2048Key=fact.generatePublic(pub2048KeySpec);
  PrivateKeyInfo keyInfo=PrivateKeyInfo.getInstance(privKey.getEncoded());
  BigInteger zero=BigInteger.valueOf(0);
  PKCS8EncodedKeySpec noCrtSpec=new PKCS8EncodedKeySpec(new PrivateKeyInfo(keyInfo.getPrivateKeyAlgorithm(),new org.bouncycastle.asn1.pkcs.RSAPrivateKey(privKeySpec.getModulus(),privKeySpec.getPublicExponent(),privKeySpec.getPrivateExponent(),zero,zero,zero,zero,zero)).getEncoded());
  PrivateKey noCrtKey=fact.generatePrivate(noCrtSpec);
  if (noCrtKey instanceof RSAPrivateCrtKey) {
    fail("String_Node_Str");
  }
  Cipher c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  byte[] out=c.doFinal(input);
  if (!areEqual(out,output[0])) {
    fail("String_Node_Str" + new String(Hex.encode(output[0])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  c.update(input);
  out=c.doFinal();
  if (!areEqual(out,output[0])) {
    fail("String_Node_Str" + new String(Hex.encode(output[0])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  c.update(input);
  out=c.doFinal();
  if (!areEqual(out,output[0])) {
    fail("String_Node_Str" + new String(Hex.encode(output[0])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  byte[] modBytes=((RSAPublicKey)pubKey).getModulus().toByteArray();
  byte[] maxInput=new byte[modBytes.length - 1];
  maxInput[0]|=0x7f;
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.doFinal(maxInput);
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,maxInput)) {
    fail("String_Node_Str" + new String(Hex.encode(maxInput)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[1])) {
    fail("String_Node_Str" + new String(Hex.encode(output[1])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[1])) {
    fail("String_Node_Str" + new String(Hex.encode(output[1])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[2])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  AlgorithmParameters oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new RSAESOAEPparams(new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1,DERNull.INSTANCE),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1,new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1,DERNull.INSTANCE)),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_pSpecified,new DEROctetString(new byte[0]))).getEncoded())) {
    fail("String_Node_Str");
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pub2048Key,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[3])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,priv2048Key);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new RSAESOAEPparams(new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224,DERNull.INSTANCE),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1,new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224,DERNull.INSTANCE)),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_pSpecified,new DEROctetString(new byte[0]))).getEncoded())) {
    fail("String_Node_Str");
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pub2048Key,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[4])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,priv2048Key);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new RSAESOAEPparams(new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256,DERNull.INSTANCE),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1,new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256,DERNull.INSTANCE)),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_pSpecified,new DEROctetString(new byte[0]))).getEncoded())) {
    fail("String_Node_Str");
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pub2048Key,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[5])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,priv2048Key);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new RSAESOAEPparams(new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha384,DERNull.INSTANCE),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1,new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha384,DERNull.INSTANCE)),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_pSpecified,new DEROctetString(new byte[0]))).getEncoded())) {
    fail("String_Node_Str");
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[6])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new RSAESOAEPparams(new AlgorithmIdentifier(PKCSObjectIdentifiers.md5,DERNull.INSTANCE),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1,new AlgorithmIdentifier(PKCSObjectIdentifiers.md5,DERNull.INSTANCE)),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_pSpecified,new DEROctetString(new byte[0]))).getEncoded())) {
    fail("String_Node_Str");
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,OAEPParameterSpec.DEFAULT,rand);
  out=c.doFinal(input);
  if (!areEqual(out,output[2])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new byte[]{0x30,0x00})) {
    fail("String_Node_Str");
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,pubKey,new OAEPParameterSpec("String_Node_Str","String_Node_Str",new MGF1ParameterSpec("String_Node_Str"),new PSource.PSpecified(new byte[]{1,2,3,4,5})),rand);
  out=c.doFinal(input);
  oaepP=c.getParameters();
  if (!areEqual(oaepP.getEncoded(),new RSAESOAEPparams(new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1,DERNull.INSTANCE),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1,new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1,DERNull.INSTANCE)),new AlgorithmIdentifier(PKCSObjectIdentifiers.id_pSpecified,new DEROctetString(new byte[]{1,2,3,4,5}))).getEncoded())) {
    fail("String_Node_Str");
  }
  if (!areEqual(out,output[7])) {
    fail("String_Node_Str" + new String(Hex.encode(output[2])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.DECRYPT_MODE,privKey,oaepP);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  byte[] isoInput=Hex.decode("String_Node_Str");
  PrivateKey isoPrivKey=fact.generatePrivate(isoPrivKeySpec);
  PublicKey isoPubKey=fact.generatePublic(isoPubKeySpec);
  c=Cipher.getInstance("String_Node_Str","String_Node_Str");
  c.init(Cipher.ENCRYPT_MODE,isoPrivKey);
  out=c.doFinal(isoInput);
  if (!areEqual(out,output[8])) {
    fail("String_Node_Str" + new String(Hex.encode(output[3])) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  c.init(Cipher.DECRYPT_MODE,isoPubKey);
  out=c.doFinal(out);
  if (!areEqual(out,isoInput)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  KeyPairGenerator keyPairGen=KeyPairGenerator.getInstance("String_Node_Str","String_Node_Str");
  keyPairGen.initialize(new RSAKeyGenParameterSpec(768,BigInteger.valueOf(65537)),new SecureRandom());
  KeyPair kp=keyPairGen.generateKeyPair();
  pubKey=kp.getPublic();
  privKey=kp.getPrivate();
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.doFinal(input);
  c.init(Cipher.DECRYPT_MODE,privKey);
  out=c.doFinal(out);
  if (!areEqual(out,input)) {
    fail("String_Node_Str" + new String(Hex.encode(input)) + "String_Node_Str"+ new String(Hex.encode(out)));
  }
  KeyFactory keyFact=KeyFactory.getInstance("String_Node_Str","String_Node_Str");
  RSAPrivateCrtKey crtKey=(RSAPrivateCrtKey)keyFact.translateKey(privKey);
  if (!privKey.equals(crtKey)) {
    fail("String_Node_Str");
  }
  crtKey=(RSAPrivateCrtKey)keyFact.generatePrivate(new PKCS8EncodedKeySpec(privKey.getEncoded()));
  if (!privKey.equals(crtKey)) {
    fail("String_Node_Str");
  }
  crtKey=(RSAPrivateCrtKey)serializeDeserialize(privKey);
  if (!privKey.equals(crtKey)) {
    fail("String_Node_Str");
  }
  if (privKey.hashCode() != crtKey.hashCode()) {
    fail("String_Node_Str");
  }
  RSAPublicKey copyKey=(RSAPublicKey)keyFact.translateKey(pubKey);
  if (!pubKey.equals(copyKey)) {
    fail("String_Node_Str");
  }
  copyKey=(RSAPublicKey)keyFact.generatePublic(new X509EncodedKeySpec(pubKey.getEncoded()));
  if (!pubKey.equals(copyKey)) {
    fail("String_Node_Str");
  }
  copyKey=(RSAPublicKey)serializeDeserialize(pubKey);
  if (!pubKey.equals(copyKey)) {
    fail("String_Node_Str");
  }
  if (pubKey.hashCode() != copyKey.hashCode()) {
    fail("String_Node_Str");
  }
  SubjectPublicKeyInfo oaepKey=new SubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.id_RSAES_OAEP,new RSAESOAEPparams()),SubjectPublicKeyInfo.getInstance(pubKey.getEncoded()).parsePublicKey());
  copyKey=(RSAPublicKey)serializeDeserialize(keyFact.generatePublic(new X509EncodedKeySpec(oaepKey.getEncoded())));
  if (!pubKey.equals(copyKey)) {
    fail("String_Node_Str");
  }
  if (pubKey.hashCode() != copyKey.hashCode()) {
    fail("String_Node_Str");
  }
  if (!Arrays.areEqual(copyKey.getEncoded(),oaepKey.getEncoded())) {
    fail("String_Node_Str");
  }
  oaepCompatibilityTest("String_Node_Str",priv2048Key,pub2048Key);
  oaepCompatibilityTest("String_Node_Str",priv2048Key,pub2048Key);
  oaepCompatibilityTest("String_Node_Str",priv2048Key,pub2048Key);
  oaepCompatibilityTest("String_Node_Str",priv2048Key,pub2048Key);
  SecureRandom random=new SecureRandom();
  rawModeTest("String_Node_Str",X509ObjectIdentifiers.id_SHA1,priv2048Key,pub2048Key,random);
  rawModeTest("String_Node_Str",PKCSObjectIdentifiers.md5,priv2048Key,pub2048Key,random);
  rawModeTest("String_Node_Str",TeleTrusTObjectIdentifiers.ripemd128,priv2048Key,pub2048Key,random);
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.update(new byte[40]);
  c.init(Cipher.ENCRYPT_MODE,pubKey,rand);
  out=c.update(new byte[40]);
  zeroMessageTest();
}