Support for backward compatibility for KeyBlobs - #110
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| if (version == 0) { | ||
| // Old KeyBlobs have 5 elements. | ||
| keyBlob = KMArray.instance((short) 5); | ||
| KMArray.cast(keyBlob).add((short) 0, keyBlobExp); |
There was a problem hiding this comment.
Let's think about these magic numbers.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| KMArray.cast(keyBlob).add(KMKeymasterApplet.KEY_BLOB_NONCE, KMByteBlob.exp()); | ||
| private short createKeyBlobExp(short version) { | ||
| short keyBlob = KMType.INVALID_VALUE; | ||
| short keyBlobExp = KMByteBlob.exp(); |
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; |
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) { |
There was a problem hiding this comment.
This will be removed as we will be relying on encrypted version only.
| // 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) { |
Merge pull request #110 from subrahmanyaman/keyblob_version
No description provided.