Beispiel #1
0
/**
 * Performs a verification on the opened MAR file.  Both the primary and backup 
 * keys stored are stored in the current process and at least the primary key 
 * will be tried.  Success will be returned as long as one of the two 
 * signatures verify.
 *
 * @return OK on success
*/
int
ArchiveReader::VerifySignature()
{
  if (!mArchive) {
    return ARCHIVE_NOT_OPEN;
  }

#ifndef MOZ_VERIFY_MAR_SIGNATURE
  return OK;
#else
#ifdef UPDATER_XPCSHELL_CERT
  int rv = VerifyLoadedCert(mArchive, xpcshellCertData);
#else
  int rv = VerifyLoadedCert(mArchive, primaryCertData);
  if (rv != OK) {
    rv = VerifyLoadedCert(mArchive, secondaryCertData);
  }
#endif
  return rv;
#endif
}
/**
 * Performs a verification on the opened MAR file.  Both the primary and backup 
 * keys stored are stored in the current process and at least the primary key 
 * will be tried.  Success will be returned as long as one of the two 
 * signatures verify.
 *
 * @return OK on success
*/
int
ArchiveReader::VerifySignature()
{
  if (!mArchive) {
    return ARCHIVE_NOT_OPEN;
  }

#ifdef XP_WIN
  // If the fallback key exists we're running an XPCShell test and we should
  // use the XPCShell specific cert for the signed MAR.
  int rv;
  if (DoesFallbackKeyExist()) {
    rv = VerifyLoadedCert(mArchive, IDR_XPCSHELL_CERT, TYPE_CERT);
  } else {
    rv = VerifyLoadedCert(mArchive, IDR_PRIMARY_CERT, TYPE_CERT);
    if (rv != OK) {
      rv = VerifyLoadedCert(mArchive, IDR_BACKUP_CERT, TYPE_CERT);
    }
  }
  return rv;
#else
  return OK;
#endif
}