@Test public void testVerify() { TestBody.test(new TestBody() { @Override protected void execute() throws Exception { String fingerprint = "fingerprint"; Keychain identities = new MockKeychain(fingerprint); DefaultVerifier v = new DefaultVerifier(identities); RequestContent requestContent = new RequestContent.Builder().addDateNow().build(); Challenge c = new Challenge(DefaultVerifierTest.class.getName(), Constants.DEFAULT_HEADERS, Arrays.asList( Algorithm.SSH_RSA )); byte[] content = requestContent.getContent(Constants.DEFAULT_HEADERS, Constants.CHARSET); Authorization a = new Authorization(fingerprint, MockKey.mockSignBase64(content), Constants.DEFAULT_HEADERS, Algorithm.SSH_RSA); assertTrue("default verifier should verify mock signature ", v.verify(c, requestContent, a)); } }); }
public boolean verify(Challenge challenge, RequestContent requestContent, Authorization authorization) { return verifyWithResult(challenge, requestContent, authorization) == VerifyResult.SUCCESS; }
DefaultVerifier implements Verifier { public boolean verify(Challenge challenge, RequestContent requestContent, Authorization authorization) { return verifyWithResult(challenge, requestContent, authorization) == VerifyResult.SUCCESS; } }
DefaultVerifier implements Verifier { public boolean verify(Challenge challenge, RequestContent requestContent, Authorization authorization) { return verifyWithResult(challenge, requestContent, authorization) == VerifyResult.SUCCESS; } DefaultVerifier(Keychain keychain);   DefaultVerifier(Keychain keychain, boolean strictRequestTarget);  DefaultVerifier(Keychain keychain, KeyId keyId);  DefaultVerifier(Keychain keychain, KeyId keyId, long skew); private  DefaultVerifier(Keychain keychain, KeyId keyId, long skew, boolean strictRequestTarget); }
DefaultVerifier implements Verifier { public boolean verify(Challenge challenge, RequestContent requestContent, Authorization authorization) { return verifyWithResult(challenge, requestContent, authorization) == VerifyResult.SUCCESS; } DefaultVerifier(Keychain keychain);   DefaultVerifier(Keychain keychain, boolean strictRequestTarget);  DefaultVerifier(Keychain keychain, KeyId keyId);  DefaultVerifier(Keychain keychain, KeyId keyId, long skew); private  DefaultVerifier(Keychain keychain, KeyId keyId, long skew, boolean strictRequestTarget); Keychain getKeychain(); long getSkew(); void setSkew(long skew); Key selectKey(Authorization authorization); boolean verify(Challenge challenge, RequestContent requestContent, Authorization authorization); VerifyResult verifyWithResult(Challenge challenge, RequestContent requestContent, Authorization authorization); }
DefaultVerifier implements Verifier { public boolean verify(Challenge challenge, RequestContent requestContent, Authorization authorization) { return verifyWithResult(challenge, requestContent, authorization) == VerifyResult.SUCCESS; } DefaultVerifier(Keychain keychain);   DefaultVerifier(Keychain keychain, boolean strictRequestTarget);  DefaultVerifier(Keychain keychain, KeyId keyId);  DefaultVerifier(Keychain keychain, KeyId keyId, long skew); private  DefaultVerifier(Keychain keychain, KeyId keyId, long skew, boolean strictRequestTarget); Keychain getKeychain(); long getSkew(); void setSkew(long skew); Key selectKey(Authorization authorization); boolean verify(Challenge challenge, RequestContent requestContent, Authorization authorization); VerifyResult verifyWithResult(Challenge challenge, RequestContent requestContent, Authorization authorization); static final long DEFAULT_SKEW; }