code: public Certificate findCertificateById(byte[] certificateId) throws CertificateNotFoundException {
          if (certificateId == null) {
              throw new CertificateNotFoundException("Certificate with id null not found from pubFile='" + this.toString() + "'");
          }
          for (InMemoryCertificateRecord record : certificateRecords) {
              if (Arrays.equals(certificateId, record.getCertificateId())) {
                  return X509CertUtil.toCert(record.getCertificate());
              }
          }
          throw new CertificateNotFoundException("Certificate with id " + Base64.encode(certificateId) + " not found from pubFile='" + this.toString() + "'");
      }
docs: Finds a certificate by certificate id.
  
  @param certificateId
  certificate id bytes
  @return certificate or null, if certificate is not found
  @throws CertificateNotFoundException
  if certificate with given id isn't found