Support for backward compatibility for KeyBlobs#110
Merged
mdwivedi merged 10 commits intoApr 11, 2022
Merged
Conversation
mdwivedi
reviewed
Apr 8, 2022
| if (version == 0) { | ||
| // Old KeyBlobs have 5 elements. | ||
| keyBlob = KMArray.instance((short) 5); | ||
| KMArray.cast(keyBlob).add((short) 0, keyBlobExp); |
Collaborator
There was a problem hiding this comment.
Let's think about these magic numbers.
mdwivedi
reviewed
Apr 8, 2022
bugfix in keyblob version changes
mdwivedi
reviewed
Apr 8, 2022
| KMArray.cast(keyBlob).add(KMKeymasterApplet.KEY_BLOB_NONCE, KMByteBlob.exp()); | ||
| private short createKeyBlobExp(short version) { | ||
| short keyBlob = KMType.INVALID_VALUE; | ||
| short keyBlobExp = KMByteBlob.exp(); |
Collaborator
There was a problem hiding this comment.
please change the name to keyByteBlobExp
| protected static final short MAX_CERT_SIZE = 2048; | ||
| // Keyblob version goes into keyblob and will affect all | ||
| // the keyblobs if it is changed. | ||
| public static final short KEYBLOB_VERSION = 1; |
Collaborator
There was a problem hiding this comment.
make it KEYBLOB_CURRENT_VERSION. Also, add the comment saying, please increment this version number whenever you change anything related to keyblob (structure, encryption algorithm etc).
| if (rot == KMType.INVALID_VALUE) { | ||
| KMException.throwIt(KMError.UNKNOWN_ERROR); | ||
| } | ||
| private short readKeyBlobVersion(short keyBlob) { |
Collaborator
There was a problem hiding this comment.
This will be removed as we will be relying on encrypted version only.
mdwivedi
reviewed
Apr 8, 2022
| // Check if the KeyBlob is compatible. If there is any change in the KeyBlob, the version | ||
| // Parameter in the KeyBlob should be updated to the next version. | ||
| short version = readKeyBlobVersion(keyBlob); | ||
| if (version < KEYBLOB_VERSION) { |
subrahmanyaman
referenced
this pull request
in subrahmanyaman/JavaCardKeymaster
Apr 11, 2022
Merge pull request #110 from subrahmanyaman/keyblob_version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.