use of com.google.crypto.tink.proto.JwtEcdsaPublicKey in project tink by google.
the class JwtEcdsaVerifyKeyManagerTest method validateKey_ok.
// Note: we use Theory as a parametrized test -- different from what the Theory framework intends.
@Theory
public void validateKey_ok(@FromDataPoints("parametersAlgos") JwtEcdsaAlgorithm algorithm) throws Exception {
if (TestUtil.isTsan()) {
// factory.createKey is too slow in Tsan.
return;
}
JwtEcdsaKeyFormat keyFormat = JwtEcdsaKeyFormat.newBuilder().setAlgorithm(algorithm).build();
JwtEcdsaPrivateKey privateKey = factory.createKey(keyFormat);
JwtEcdsaPublicKey publicKey = signManager.getPublicKey(privateKey);
verifyManager.validateKey(publicKey);
}
use of com.google.crypto.tink.proto.JwtEcdsaPublicKey in project tink by google.
the class JwtEcdsaVerifyKeyManagerTest method createPrimitive_ok.
// Note: we use Theory as a parametrized test -- different from what the Theory framework intends.
@Theory
public void createPrimitive_ok(@FromDataPoints("parametersAlgos") JwtEcdsaAlgorithm algorithm) throws Exception {
if (TestUtil.isTsan()) {
// factory.createKey is too slow in Tsan.
return;
}
JwtEcdsaKeyFormat keyFormat = JwtEcdsaKeyFormat.newBuilder().setAlgorithm(algorithm).build();
JwtEcdsaPrivateKey privateKey = factory.createKey(keyFormat);
JwtEcdsaPublicKey publicKey = signManager.getPublicKey(privateKey);
JwtPublicKeySignInternal signer = signManager.getPrimitive(privateKey, JwtPublicKeySignInternal.class);
JwtPublicKeyVerifyInternal verifier = verifyManager.getPrimitive(publicKey, JwtPublicKeyVerifyInternal.class);
RawJwt token = RawJwt.newBuilder().withoutExpiration().build();
JwtValidator validator = JwtValidator.newBuilder().allowMissingExpiration().build();
verifier.verifyAndDecodeWithKid(signer.signAndEncodeWithKid(token, Optional.empty()), validator, Optional.empty());
}
Aggregations