use of com.google.crypto.tink.proto.EcdsaPublicKey in project tink by google.
the class EcdsaVerifyKeyManager method getPrimitive.
/**
* @param key {@code EcdsaPublicKey} proto
*/
@Override
public PublicKeyVerify getPrimitive(MessageLite key) throws GeneralSecurityException {
if (!(key instanceof EcdsaPublicKey)) {
throw new GeneralSecurityException("expected EcdsaPublicKey proto");
}
EcdsaPublicKey keyProto = (EcdsaPublicKey) key;
validate(keyProto);
ECPublicKey publicKey = EllipticCurves.getEcPublicKey(SigUtil.toCurveType(keyProto.getParams().getCurve()), keyProto.getX().toByteArray(), keyProto.getY().toByteArray());
return new EcdsaVerifyJce(publicKey, SigUtil.toEcdsaAlgo(keyProto.getParams().getHashType()));
}
Aggregations