Program: 48141
Project: 48141
Buggy source:
@Override public VerifySignatureResponse perform(VerifySignature request,Map<String,Object> internalData){
  VerifySignatureResponse response=WSHelper.makeResponse(VerifySignatureResponse.class,WSHelper.makeResultOK());
  try {
    ConnectionHandleType connectionHandle=SALUtils.getConnectionHandle(request);
    CardStateEntry cardStateEntry=SALUtils.getCardStateEntry(internalData,connectionHandle);
    String didName=SALUtils.getDIDName(request);
    DIDStructureType didStructure=SALUtils.getDIDStructure(request,didName,cardStateEntry,connectionHandle);
    byte[] signature=request.getSignature();
    byte[] message=request.getMessage();
    CryptoMarkerType cryptoMarker=new CryptoMarkerType(didStructure.getDIDMarker());
    String dataSetNameCertificate=cryptoMarker.getCertificateRef().getDataSetName();
    String algorithmIdentifier=cryptoMarker.getAlgorithmInfo().getAlgorithmIdentifier().getAlgorithm();
    DSIRead dsiRead=new DSIRead();
    dsiRead.setConnectionHandle(connectionHandle);
    dsiRead.setDSIName(dataSetNameCertificate);
    DSIReadResponse dsiReadResponse=(DSIReadResponse)dispatcher.deliver(dsiRead);
    WSHelper.checkResult(dsiReadResponse);
    CertificateFactory certFactory=CertificateFactory.getInstance("String_Node_Str");
    Certificate cert=(X509Certificate)certFactory.generateCertificate(new ByteArrayInputStream(dsiReadResponse.getDSIContent()));
    Signature signatureAlgorithm;
    if (algorithmIdentifier.equals(GenericCryptoObjectIdentifier.pkcs_1)) {
      signatureAlgorithm=Signature.getInstance("String_Node_Str",new BouncyCastleProvider());
    }
 else     if (algorithmIdentifier.equals(GenericCryptoObjectIdentifier.id_RSASSA_PSS)) {
      signatureAlgorithm=Signature.getInstance("String_Node_Str",new BouncyCastleProvider());
      signatureAlgorithm.setParameter(new PSSParameterSpec("String_Node_Str","String_Node_Str",new MGF1ParameterSpec("String_Node_Str"),32,1));
    }
 else     if (algorithmIdentifier.equals(GenericCryptoObjectIdentifier.sigS_ISO9796_2)) {
      return WSHelper.makeResponse(VerifySignatureResponse.class,WSHelper.makeResultUnknownError(algorithmIdentifier + "String_Node_Str"));
    }
 else     if (algorithmIdentifier.equals(GenericCryptoObjectIdentifier.sigS_ISO9796_2rnd)) {
      return WSHelper.makeResponse(VerifySignatureResponse.class,WSHelper.makeResultUnknownError(algorithmIdentifier + "String_Node_Str"));
    }
 else {
      throw new IncorrectParameterException("String_Node_Str");
    }
    signatureAlgorithm.initVerify(cert);
    if (message != null) {
      signatureAlgorithm.update(message);
    }
    if (!signatureAlgorithm.verify(signature)) {
      throw new InvalidSignatureException();
    }
  }
 catch (  ECardException e) {
    logger.error(e.getMessage(),e);
    response.setResult(e.getResult());
  }
catch (  Exception e) {
    response.setResult(WSHelper.makeResult(e));
  }
  return response;
}

Fixed version (ground truth):
@Override public VerifySignatureResponse perform(VerifySignature request,Map<String,Object> internalData){
  VerifySignatureResponse response=WSHelper.makeResponse(VerifySignatureResponse.class,WSHelper.makeResultOK());
  try {
    ConnectionHandleType connectionHandle=SALUtils.getConnectionHandle(request);
    CardStateEntry cardStateEntry=SALUtils.getCardStateEntry(internalData,connectionHandle);
    String didName=SALUtils.getDIDName(request);
    DIDStructureType didStructure=SALUtils.getDIDStructure(request,didName,cardStateEntry,connectionHandle);
    byte[] signature=request.getSignature();
    byte[] message=request.getMessage();
    CryptoMarkerType cryptoMarker=new CryptoMarkerType(didStructure.getDIDMarker());
    String dataSetNameCertificate=cryptoMarker.getCertificateRefs().get(0).getDataSetName();
    String algorithmIdentifier=cryptoMarker.getAlgorithmInfo().getAlgorithmIdentifier().getAlgorithm();
    DSIRead dsiRead=new DSIRead();
    dsiRead.setConnectionHandle(connectionHandle);
    dsiRead.setDSIName(dataSetNameCertificate);
    DSIReadResponse dsiReadResponse=(DSIReadResponse)dispatcher.deliver(dsiRead);
    WSHelper.checkResult(dsiReadResponse);
    CertificateFactory certFactory=CertificateFactory.getInstance("String_Node_Str");
    Certificate cert=(X509Certificate)certFactory.generateCertificate(new ByteArrayInputStream(dsiReadResponse.getDSIContent()));
    Signature signatureAlgorithm;
    if (algorithmIdentifier.equals(GenericCryptoObjectIdentifier.pkcs_1)) {
      signatureAlgorithm=Signature.getInstance("String_Node_Str",new BouncyCastleProvider());
    }
 else     if (algorithmIdentifier.equals(GenericCryptoObjectIdentifier.id_RSASSA_PSS)) {
      signatureAlgorithm=Signature.getInstance("String_Node_Str",new BouncyCastleProvider());
      signatureAlgorithm.setParameter(new PSSParameterSpec("String_Node_Str","String_Node_Str",new MGF1ParameterSpec("String_Node_Str"),32,1));
    }
 else     if (algorithmIdentifier.equals(GenericCryptoObjectIdentifier.sigS_ISO9796_2)) {
      return WSHelper.makeResponse(VerifySignatureResponse.class,WSHelper.makeResultUnknownError(algorithmIdentifier + "String_Node_Str"));
    }
 else     if (algorithmIdentifier.equals(GenericCryptoObjectIdentifier.sigS_ISO9796_2rnd)) {
      return WSHelper.makeResponse(VerifySignatureResponse.class,WSHelper.makeResultUnknownError(algorithmIdentifier + "String_Node_Str"));
    }
 else {
      throw new IncorrectParameterException("String_Node_Str");
    }
    signatureAlgorithm.initVerify(cert);
    if (message != null) {
      signatureAlgorithm.update(message);
    }
    if (!signatureAlgorithm.verify(signature)) {
      throw new InvalidSignatureException();
    }
  }
 catch (  ECardException e) {
    logger.error(e.getMessage(),e);
    response.setResult(e.getResult());
  }
catch (  Exception e) {
    response.setResult(WSHelper.makeResult(e));
  }
  return response;
}