Validators { public static void validateRsaPublicExponent( BigInteger publicExponent) throws GeneralSecurityException { if (!publicExponent.testBit(0)) { throw new GeneralSecurityException("Public exponent must be odd."); } if (publicExponent.compareTo(BigInteger.valueOf(65536)) <= 0) { throw new GeneralSecurityException("Public exponent must be greater than 65536."); } } private  Validators(); static void validateTypeUrl(String typeUrl); static void validateAesKeySize(int sizeInBytes); static void validateVersion(int candidate, int maxExpected); static void validateSignatureHash(HashType hash); static void validateRsaModulusSize(int modulusSize); static void validateRsaPublicExponent(
      BigInteger publicExponent); static void validateNotExists(File f); static void validateExists(File f); static String validateKmsKeyUriAndRemovePrefix(String expectedPrefix, String kmsKeyUri); static void validateCryptoKeyUri(String kmsKeyUri);  }
@Test public void testValidateRsaPublicExponent() throws Exception { Validators.validateRsaPublicExponent(BigInteger.valueOf(65537)); try { Validators.validateRsaPublicExponent(BigInteger.valueOf(65535)); fail("Expected GeneralSecurityException"); } catch (GeneralSecurityException e) { } try { Validators.validateRsaPublicExponent(BigInteger.valueOf(65538)); fail("Expected GeneralSecurityException"); } catch (GeneralSecurityException e) { } }