Comments (5)
Can you tell me why you need to read a reader multiple times? In Tink's design, a reader is a temporary object that should be immediately discarded after it is used to obtain a KeysetHandle.
from tink.
Sure. I only brought this up since this was a change that broke my framework when I updated to the latest release. I am fine with your response, makes sense, readers generally are used only use. I just got bit by the fact that a reader instantiated with JSON is able to be reused. If anything, I am abusing this.
Anyways, this is why..
I am reading in a keyset from some source and need to differentiate between NoSecret and Secret containing keysets.
try {
KeysetHandle keysetHandle = NoSecretKeysetHandle.read(reader);
return new TinkPublicKeyset(keysetHandle);
} catch (GeneralSecurityException ex) {
KeysetHandle keysetHandle = CleartextKeysetHandle.read(reader);
return new TinkKeyset(keysetHandle);
}
Thanks!
from tink.
Oh I see. This is an interesting usage. I guess at some point downstream you'd have to check whether you're dealing with TinkPublicKeyset or TinkKeyset, right? I'd rather separate them completely from the beginning.
How did you fix it?
from tink.
Im not sure yet if I can do this a different layer since this is reading a keyset from some source (disk, kms).
But as a temporary fix, I just instantiated my reader with JsonKeysetReader.withJsonObject(json..)
instead of JsonKeysetReader.withString(string..)
from tink.
Anyways, I will close this as you have already given me a proper response.
Thanks!
from tink.
Related Issues (20)
- tink cannot be installed on arm64 linux HOT 9
- Cannot install it with googleapis-common-protos and other related libs in python HOT 7
- Envelope AEAD Performance with GCP KMS HOT 1
- java tink library is not scaling with java threads HOT 1
- Tink installation on bazel and pip3 fail HOT 4
- Missing classes dectected while running R8 HOT 11
- Is Tink for Objective-C buildable via Bazel? HOT 9
- Recommendation on the best approach for rotation HOT 1
- tink 1.7.0 depends on protobuf 3.20.1 which has a security vulnerability patched in a newer version HOT 4
- Windows OS Support HOT 4
- Cannot download tinkey - The project to be billed is associated with a closed billing account. HOT 2
- cannot verify signature HOT 3
- java.security.GeneralSecurityException: cannot verify signature HOT 1
- No manager for type 'type.googleapis.com/google.crypto.tink.HpkePrivateKey' has been registered HOT 2
- H HOT 1
- compile tink cpp library for ios HOT 4
- OSS-Fuzz issue 66058 HOT 1
- Intent to archive https://github.com/google/tink
- Duplicate class found in modules jetified-tink-1.8.0 and jetified-tink-android-1.8.0 HOT 1
- Add PRF Documentation to website HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tink.