Fixes for Android

- Allow info to be null/empty in HKDF arguments. This is used during
  KBS attestation.
- Allow creating an ECPublicKey from the un-typed key bytes, also used
  when talking to KBS.
This commit is contained in:
Jack Lloyd
2020-11-11 11:48:27 -05:00
parent 82dbf03905
commit 54835b0a03
2 changed files with 12 additions and 1 deletions

View File

@@ -24,6 +24,13 @@ public class ECPublicKey implements Comparable<ECPublicKey> {
this.handle = Native.ECPublicKey_Deserialize(serialized, 0);
}
static public ECPublicKey fromPublicKey(byte[] key) {
byte[] with_type = new byte[33];
with_type[0] = 0x05;
System.arraycopy(key, 0, with_type, 1, 32);
return new ECPublicKey(Native.ECPublicKey_Deserialize(with_type, 0));
}
public ECPublicKey(long nativeHandle) {
if (nativeHandle == 0) {
throw new NullPointerException();