runDecryptTest = function(info, done) {
    var messageData = fs.readFileSync(info.baseName + '.asc', 'utf-8');
    var message =
        global.e2e.openpgp.block.factory.parseAsciiMessage(messageData);
    assert(typeof info.decryptKey == 'string', 'Missing decryptKey field');
    var decryptCert = readKey(path.join(info.baseDir, info.decryptKey));
    // If the optional public key is available, the message should also
    // be signed by this public key.
    var verifyCert = null;
    if (typeof info.verifyKey == 'string') {
      verifyCert = readKey(path.join(info.baseDir, info.verifyKey));
    }

    var result = message.decrypt(function(keyid) {
      if (global.e2e.compareByteArray(decryptCert.keyPacket.keyId, keyid)) {
        return global.e2e.async.Result.toResult(
            unlock(decryptCert.keyPacket, info.passphrase).cipher);
      }
      var ret = null;
      if (decryptCert.subKeys != null) {
        decryptCert.subKeys.forEach(function(subkey) {
          if (global.e2e.compareByteArray(subkey.keyId, keyid)) {
            ret = unlock(subkey, info.passphrase).cipher;
          }
        });
      }
      return global.e2e.async.Result.toResult(ret);
    }, null);

    result.then(function(message) {
      message = message.getLiteralMessage(message);
      if (info.filename != null) {
        assert.equal(info.filename, message.getFilename());
      }
      if (info.timestamp != null) {
        assert.equal(info.timestamp, message.getTimestamp());
      }
      if (info.textcontent != null) {
        assert.equal(
            new Buffer(message.getData()).toString('utf-8'), info.textcontent);
      }
      if (verifyCert != null) {
        return message.verify([verifyCert]).then(function(verify) {
          assert.equal(verify.success.length, 1, 'No successful verifications');
          assert.equal(verify.failure.length, 0, 'Unexpected failures');
        });
      }
    }).then(done);
  }
Decrypts a message and verifies the result against information
provided by the testcase.
@param {!Object} info The parsed json file with the test case info.
@param {function()} done A function to call once the test completes.