H Tink Save JSON File

This article belongs to H Verify external signature in Tink and is part 3.

The Google Tink-environment encapsulates especially the keys for a usage outside of Tink so it’s also a problem to bring external Keys inside of Tink. To solve this problem I’m creating a Public Key-file in JSON-format, but instead of using libraries (like JSON or JSON SIMPLE) I’m writing the file „handmade“.

I’m for shure there might be better (looking ?) solutions but as there are only two „flexible“ data fields (primaryKeyId and value) I hardcoded the file structure. To get a random KeyId I used two small code segments from Tink KeysetManager.java. This helper class belongs to this article: H Tink Verify an ECDSA signature with Tink.

As this is a helper class there is no console output.

All sourcecodes to this solution are available in my Github-Archive with this link: https://github.com/java-crypto/H-Google-Tink. All programs run with Java 8 and Java 11.

The licence (or better unlicence) to my solution is available here: Lizenz-Seite.

Last edit: 18.11.2019