-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from divegeek/Javacard_KeyMint_100_master
Javacard key mint 100 master
- Loading branch information
Showing
75 changed files
with
9,224 additions
and
248 deletions.
There are no files selected for viewing
435 changes: 435 additions & 0 deletions
435
Applet/AndroidSEProvider/src/com/android/javacard/keymaster/KMAndroidSEApplet.java
Large diffs are not rendered by default.
Oops, something went wrong.
1,056 changes: 1,056 additions & 0 deletions
1,056
Applet/AndroidSEProvider/src/com/android/javacard/keymaster/KMAttestationCertImpl.java
Large diffs are not rendered by default.
Oops, something went wrong.
422 changes: 422 additions & 0 deletions
422
Applet/AndroidSEProvider/src/com/android/javacard/keymaster/KMUtils.java
Large diffs are not rendered by default.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
Applet/AndroidSEProviderLib/src/com/android/javacard/seprovider/KMAESKey.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright(C) 2020 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" (short)0IS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.android.javacard.seprovider; | ||
|
||
import org.globalplatform.upgrade.Element; | ||
|
||
import javacard.security.AESKey; | ||
|
||
public class KMAESKey implements KMMasterKey { | ||
|
||
private AESKey aesKey; | ||
|
||
public KMAESKey(AESKey key) { | ||
aesKey = key; | ||
} | ||
|
||
public void setKey(byte[] keyData, short kOff) { | ||
aesKey.setKey(keyData, kOff); | ||
} | ||
|
||
public byte getKey(byte[] keyData, short kOff) { | ||
return aesKey.getKey(keyData, kOff); | ||
} | ||
|
||
public short getKeySizeBits() { | ||
return aesKey.getSize(); | ||
} | ||
|
||
public static void onSave(Element element, KMAESKey kmKey) { | ||
element.write(kmKey.aesKey); | ||
} | ||
|
||
public static KMAESKey onRestore(Element element) { | ||
AESKey aesKey = (AESKey) element.readObject(); | ||
KMAESKey kmKey = new KMAESKey(aesKey); | ||
return kmKey; | ||
} | ||
|
||
public static short getBackupPrimitiveByteCount() { | ||
return (short) 0; | ||
} | ||
|
||
public static short getBackupObjectCount() { | ||
return (short) 1; | ||
} | ||
|
||
} |
Oops, something went wrong.