Token { public boolean validate(String pubKey, int allowedOffset) { return validate(pubKey, allowedOffset, false, null); }  String getDigestAlgorithm(); void sign(String privKey); void sign(PrivateKey key); void setTimeStamp(long issueTime, long expirationWindow); boolean validate(String pubKey, int allowedOffset); boolean validate(String pubKey, int allowedOffset, boolean allowNoExpiry); boolean validate(String pubKey, int allowedOffset, boolean allowNoExpiry,
            StringBuilder errMsg); boolean validate(PublicKey publicKey, int allowedOffset, boolean allowNoExpiry,
            StringBuilder errMsg); String getVersion(); String getSalt(); String getHost(); String getDomain(); String getSignature(); long getTimestamp(); long getExpiryTime(); String getSignedToken(); String getKeyId(); String getIP(); String getUnsignedToken(); static String getUnsignedToken(String credential);  }
@Test public void testTokenValidateNullSignature() throws CryptoException { PrincipalToken token = new PrincipalToken.Builder(svcVersion, svcDomain, svcName) .host(host).salt(salt).expirationWindow(expirationTime).build(); assertFalse(token.validate(servicePublicKeyStringK0, 3600, false)); assertFalse(token.validate(servicePublicKeyStringK0, 3600, false, null)); StringBuilder errMsg = new StringBuilder(); assertFalse(token.validate(servicePublicKeyStringK0, 3600, false, errMsg)); assertTrue(!errMsg.toString().isEmpty()); }
@Test public void testTokenValidateNullData() throws CryptoException { Token token = new Token(); assertFalse(token.validate(servicePublicKeyStringK0, 3600, false)); }