Program: 40333
Project: 40333
Buggy source:
public MessageLite sendTPM2Ddata(Event e){
  this.yourNonce=e.getMessage().getAttestationResponse().getQualifyingData().toString();
  this.yourQuoted=DatatypeConverter.parseHexBinary(e.getMessage().getAttestationResponse().getQuoted());
  this.yourSignature=DatatypeConverter.parseHexBinary(e.getMessage().getAttestationResponse().getSignature());
  this.certUri=e.getMessage().getAttestationResponse().getCertificateUri();
  byte[] bkey=new byte[0];
  PublicKey publicKey=null;
  PublicKeyConverter conv=null;
  TPM2B_PUBLIC key=null;
  try {
    bkey=this.fetchPublicKey(this.certUri);
    key=new TPM2B_PUBLIC(bkey);
    conv=new PublicKeyConverter(key);
    publicKey=conv.getPublicKey();
  }
 catch (  Exception ex) {
    LOG.debug("String_Node_Str" + this.certUri + "String_Node_Str"+ ex.getMessage());
    ex.printStackTrace();
    return ControllerToTpm.newBuilder().build();
  }
  try {
    TPMT_SIGNATURE signature=new TPMT_SIGNATURE(this.yourSignature);
    TPMS_ATTEST quoted=new TPMS_ATTEST(this.yourQuoted);
    byte[] dig=quoted.getAttested().getDigest().getBuffer();
    byte[] sign=signature.getSignature().getSig();
switch (signature.getSignature().getHashAlg()) {
case TPM_ALG_SHA256:
      LOG.debug("String_Node_Str" + ByteArrayUtil.toPrintableHexString(publicKey.getEncoded()).replaceAll("String_Node_Str","String_Node_Str"));
    LOG.debug("String_Node_Str" + ByteArrayUtil.toPrintableHexString(sign).replaceAll("String_Node_Str","String_Node_Str"));
  LOG.debug("String_Node_Str" + ByteArrayUtil.toPrintableHexString(dig).replaceAll("String_Node_Str","String_Node_Str"));
LOG.debug("String_Node_Str" + new String(quoted.getExtraData().getBuffer()));
LOG.debug("String_Node_Str" + this.checkSignRsaPssSha256(publicKey,sign,dig));
break;
case TPM_ALG_SHA1:
default :
LOG.debug("String_Node_Str" + signature.getSignature().getHashAlg().toString() + "String_Node_Str");
break;
}
}
 catch (Exception ex) {
LOG.debug("String_Node_Str" + ex.getMessage());
ex.printStackTrace();
return ControllerToTpm.newBuilder().build();
}
if (thread.isAlive()) {
try {
ControllerToTpm msg=ControllerToTpm.newBuilder().setAtype(this.aType).setQualifyingData(this.yourNonce).setCode(Code.INTERNAL_ATTESTATION_REQ).build();
client.send(msg.toByteArray(),this.handler);
TpmToController answer=this.handler.waitForResponse();
return ConnectorMessage.newBuilder().setId(0).setType(ConnectorMessage.Type.RAT_RESPONSE).setAttestationResponse(AttestationResponse.newBuilder().setAtype(this.aType).setHalg(answer.getHalg()).setQuoted(answer.getQuoted()).setSignature(answer.getSignature()).addAllPcrValues(answer.getPcrValuesList()).setCertificateUri(answer.getCertificateUri()).build()).build();
}
 catch (IOException e1) {
LOG.debug("String_Node_Str");
e1.printStackTrace();
return ControllerToTpm.newBuilder().build();
}
catch (InterruptedException e1) {
LOG.debug("String_Node_Str");
e1.printStackTrace();
return ControllerToTpm.newBuilder().build();
}
}
 else {
LOG.debug("String_Node_Str");
return null;
}
}

Fixed version (ground truth):
public MessageLite sendTPM2Ddata(Event e){
  this.yourNonce=e.getMessage().getAttestationResponse().getQualifyingData().toString();
  this.yourQuoted=DatatypeConverter.parseHexBinary(e.getMessage().getAttestationResponse().getQuoted());
  this.yourSignature=DatatypeConverter.parseHexBinary(e.getMessage().getAttestationResponse().getSignature());
  this.certUri=e.getMessage().getAttestationResponse().getCertificateUri();
  byte[] bkey=new byte[0];
  PublicKey publicKey=null;
  PublicKeyConverter conv=null;
  TPM2B_PUBLIC key=null;
  try {
    bkey=this.fetchPublicKey(this.certUri);
    key=new TPM2B_PUBLIC(bkey);
    conv=new PublicKeyConverter(key);
    publicKey=conv.getPublicKey();
  }
 catch (  Exception ex) {
    LOG.debug("String_Node_Str" + this.certUri + "String_Node_Str"+ ex.getMessage());
    ex.printStackTrace();
    return ControllerToTpm.newBuilder().build();
  }
  try {
    TPMT_SIGNATURE signature=new TPMT_SIGNATURE(this.yourSignature);
    TPMS_ATTEST quoted=new TPMS_ATTEST(this.yourQuoted);
    byte[] dig=quoted.getAttested().getDigest().getBuffer();
    LOG.debug(signature.toString());
    byte[] sign=signature.getSignature().getSig();
switch (signature.getSignature().getHashAlg()) {
case TPM_ALG_SHA256:
      LOG.debug("String_Node_Str" + ByteArrayUtil.toPrintableHexString(publicKey.getEncoded()).replaceAll("String_Node_Str","String_Node_Str"));
    LOG.debug("String_Node_Str" + ByteArrayUtil.toPrintableHexString(sign).replaceAll("String_Node_Str","String_Node_Str"));
  LOG.debug("String_Node_Str" + ByteArrayUtil.toPrintableHexString(dig).replaceAll("String_Node_Str","String_Node_Str"));
LOG.debug("String_Node_Str" + new String(quoted.getExtraData().getBuffer()));
LOG.debug("String_Node_Str" + this.checkSignRsaPssSha256(publicKey,sign,dig));
break;
case TPM_ALG_SHA1:
default :
LOG.debug("String_Node_Str" + signature.getSignature().getHashAlg().toString() + "String_Node_Str");
break;
}
}
 catch (Exception ex) {
LOG.debug("String_Node_Str" + ex.getMessage());
ex.printStackTrace();
return ControllerToTpm.newBuilder().build();
}
if (thread.isAlive()) {
try {
ControllerToTpm msg=ControllerToTpm.newBuilder().setAtype(this.aType).setQualifyingData(this.yourNonce).setCode(Code.INTERNAL_ATTESTATION_REQ).build();
client.send(msg.toByteArray(),this.handler);
TpmToController answer=this.handler.waitForResponse();
return ConnectorMessage.newBuilder().setId(0).setType(ConnectorMessage.Type.RAT_RESPONSE).setAttestationResponse(AttestationResponse.newBuilder().setAtype(this.aType).setHalg(answer.getHalg()).setQuoted(answer.getQuoted()).setSignature(answer.getSignature()).addAllPcrValues(answer.getPcrValuesList()).setCertificateUri(answer.getCertificateUri()).build()).build();
}
 catch (IOException e1) {
LOG.debug("String_Node_Str");
e1.printStackTrace();
return ControllerToTpm.newBuilder().build();
}
catch (InterruptedException e1) {
LOG.debug("String_Node_Str");
e1.printStackTrace();
return ControllerToTpm.newBuilder().build();
}
}
 else {
LOG.debug("String_Node_Str");
return null;
}
}