code: public synchronized void verify(PublicKey key, String sigProvider)
              throws CertificateException, NoSuchAlgorithmException,
              InvalidKeyException, NoSuchProviderException, SignatureException {
          if (sigProvider == null) {
              sigProvider = "";
          }
          if ((verifiedPublicKey != null) && verifiedPublicKey.equals(key)) {
              // this certificate has already been verified using
              // this public key. Make sure providers match, too.
              if (sigProvider.equals(verifiedProvider)) {
                  if (verificationResult) {
                      return;
                  } else {
                      throw new SignatureException("Signature does not match.");
                  }
              }
          }
          if (signedCert == null) {
              throw new CertificateEncodingException("Uninitialized certificate");
          }
          // Verify the signature ...
          Signature sigVerf = null;
          if (sigProvider.length() == 0) {
              sigVerf = Signature.getInstance(algId.getName());
          } else {
              sigVerf = Signature.getInstance(algId.getName(), sigProvider);
          }
          sigVerf.initVerify(key);
  
          byte[] rawCert = info.getEncodedInfo();
          sigVerf.update(rawCert, 0, rawCert.length);
  
          // verify may throw SignatureException for invalid encodings, etc.
          verificationResult = sigVerf.verify(signature);
          verifiedPublicKey = key;
          verifiedProvider = sigProvider;
  
          if (verificationResult == false) {
              throw new SignatureException("Signature does not match.");
          }
      }
docs: Throws an exception if the certificate was not signed using the
  verification key provided.  Successfully verifying a certificate
  does <em>not</em> indicate that one should trust the entity which
  it represents.
  
  @param key the public key used for verification.
  @param sigProvider the name of the provider.
  
  @exception NoSuchAlgorithmException on unsupported signature
  algorithms.
  @exception InvalidKeyException on incorrect key.
  @exception NoSuchProviderException on incorrect provider.
  @exception SignatureException on signature errors.
  @exception CertificateException on encoding errors.