code: public static final void validate(KeySpec keySpec)
              throws InvalidKeyException {
          if (keySpec == null) {
              throw new NullPointerException(
                  "The key spec to be validated cannot be null");
          }
  
          if (keySpec instanceof DHPublicKeySpec) {
              validateDHPublicKey((DHPublicKeySpec)keySpec);
          }
      }
docs: Returns whether the key spec is valid or not.
  <P>
  Note that this method is only apply to DHPublicKeySpec at present.
  
  @param  keySpec
  the key spec object, cannot be null
  
  @throws NullPointerException if {@code keySpec} is null
  @throws InvalidKeyException if {@code keySpec} is invalid