@Override
  public MessageLite newKey(MessageLite keyFormat) throws GeneralSecurityException {
    if (!(keyFormat instanceof HmacKeyFormat)) {
      throw new GeneralSecurityException("expected HmacKeyFormat proto");
    }
    HmacKeyFormat format = (HmacKeyFormat) keyFormat;
    validate(format);
    return HmacKey.newBuilder()
        .setVersion(VERSION)
        .setParams(format.getParams())
        .setKeyValue(ByteString.copyFrom(Random.randBytes(format.getKeySize())))
        .build();
  }
@param keyFormat {@code HmacKeyFormat} proto
@return new {@code HmacKey} proto
java_src/src/main/java/com/google/crypto/tink/mac/internal/LegacyHmacTestKeyManager.java