public static final void validateRsaSsaPkcs1(
      RSAPrivateCrtKey privateKey, RSAPublicKey publicKey, Enums.HashType sigHash)
      throws GeneralSecurityException {

    RsaSsaPkcs1SignJce rsaSigner = new RsaSsaPkcs1SignJce(privateKey, sigHash);
    RsaSsaPkcs1VerifyJce rsaVerifier = new RsaSsaPkcs1VerifyJce(publicKey, sigHash);
    try {
      rsaVerifier.verify(rsaSigner.sign(TEST_MESSAGE.toByteArray()), TEST_MESSAGE.toByteArray());
    } catch (GeneralSecurityException e) {
      throw new GeneralSecurityException(
          "RSA PKCS1 signing with private key followed by verifying with public key failed."
              + " The key may be corrupted.",
          e);
    }
  }
Self Key tests validation helper methods.
java_src/src/main/java/com/google/crypto/tink/subtle/SelfKeyTestValidators.java