-
Notifications
You must be signed in to change notification settings - Fork 26
Support for backward compatibility for KeyBlobs #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for backward compatibility for KeyBlobs #110
Conversation
Applet/src/com/android/javacard/keymaster/KMKeymasterApplet.java
Outdated
Show resolved
Hide resolved
Applet/src/com/android/javacard/keymaster/KMKeymasterApplet.java
Outdated
Show resolved
Hide resolved
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's think about these magic numbers.
Applet/src/com/android/javacard/keymaster/KMKeymasterApplet.java
Outdated
Show resolved
Hide resolved
Applet/src/com/android/javacard/keymaster/KMKeymasterApplet.java
Outdated
Show resolved
Hide resolved
Applet/src/com/android/javacard/keymaster/KMKeymasterApplet.java
Outdated
Show resolved
Hide resolved
Applet/src/com/android/javacard/keymaster/KMKeymasterApplet.java
Outdated
Show resolved
Hide resolved
bugfix in keyblob version changes
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this after parsing.
Merge pull request #110 from subrahmanyaman/keyblob_version
No description provided.