@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.library)
|
||||
}
|
||||
|
||||
|
||||
android {
|
||||
namespace = "io.github.beakthoven.stub"
|
||||
compileSdk = 36
|
||||
buildToolsVersion = "36.0.0"
|
||||
defaultConfig {
|
||||
minSdk = 29
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
lint {
|
||||
checkReleaseBuilds = false
|
||||
abortOnError = true
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.annotation)
|
||||
compileOnly(libs.dev.rikka.hidden.stub)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
-->
|
||||
|
||||
<manifest/>
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.app;
|
||||
|
||||
public class ActivityThread {
|
||||
public static void initializeMainlineModules() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.content.pm;
|
||||
|
||||
import android.os.IBinder;
|
||||
|
||||
public interface IPackageManager {
|
||||
String[] getPackagesForUid(int uid);
|
||||
|
||||
PackageInfo getPackageInfo(String packageName, long flags, int userId);
|
||||
|
||||
PackageInfo getPackageInfo(String packageName, int flags, int userId);
|
||||
|
||||
ParceledListSlice<PackageInfo> getInstalledPackages(int flags, int userId);
|
||||
|
||||
ParceledListSlice<PackageInfo> getInstalledPackages(long flags, int userId);
|
||||
|
||||
class Stub {
|
||||
public static IPackageManager asInterface(IBinder binder) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.hardware.security.keymint;
|
||||
|
||||
public @interface Algorithm {
|
||||
int AES = 32;
|
||||
int EC = 3;
|
||||
int HMAC = 128;
|
||||
int RSA = 1;
|
||||
int TRIPLE_DES = 33;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.hardware.security.keymint;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public @interface EcCurve {
|
||||
public static final int CURVE_25519 = 4;
|
||||
public static final int P_224 = 0;
|
||||
public static final int P_256 = 1;
|
||||
public static final int P_384 = 2;
|
||||
public static final int P_521 = 3;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.hardware.security.keymint;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class KeyParameter implements Parcelable {
|
||||
public static final Creator<KeyParameter> CREATOR = new Creator<>() {
|
||||
@Override
|
||||
public KeyParameter createFromParcel(Parcel in) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyParameter[] newArray(int size) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
};
|
||||
public int tag = 0;
|
||||
public KeyParameterValue value;
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel parcel, int i) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.hardware.security.keymint;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class KeyParameterValue implements Parcelable {
|
||||
public static final int algorithm = 1;
|
||||
public static final int blob = 14;
|
||||
public static final int blockMode = 2;
|
||||
public static final int boolValue = 10;
|
||||
public static final int dateTime = 13;
|
||||
public static final int digest = 4;
|
||||
public static final int ecCurve = 5;
|
||||
public static final int hardwareAuthenticatorType = 8;
|
||||
public static final int integer = 11;
|
||||
public static final int invalid = 0;
|
||||
public static final int keyPurpose = 7;
|
||||
public static final int longInteger = 12;
|
||||
public static final int origin = 6;
|
||||
public static final int paddingMode = 3;
|
||||
public static final int securityLevel = 9;
|
||||
public static final Creator<KeyParameterValue> CREATOR = new Creator<KeyParameterValue>() {
|
||||
@Override
|
||||
public KeyParameterValue createFromParcel(Parcel in) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyParameterValue[] newArray(int size) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
};
|
||||
|
||||
public KeyParameterValue() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
protected KeyParameterValue(Parcel in) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue invalid(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue algorithm(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue blockMode(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue paddingMode(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue digest(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue ecCurve(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue origin(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue keyPurpose(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue hardwareAuthenticatorType(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue securityLevel(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue boolValue(boolean _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue integer(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue longInteger(long _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue dateTime(long _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static KeyParameterValue blob(byte[] _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public int getTag() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public int getInvalid() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setInvalid(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public int getAlgorithm() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setAlgorithm(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public int getBlockMode() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setBlockMode(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public int getPaddingMode() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setPaddingMode(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public int getDigest() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setDigest(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public int getEcCurve() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setEcCurve(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public int getOrigin() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setOrigin(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public int getKeyPurpose() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setKeyPurpose(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public int getHardwareAuthenticatorType() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setHardwareAuthenticatorType(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public int getSecurityLevel() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setSecurityLevel(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public boolean getBoolValue() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setBoolValue(boolean _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public int getInteger() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setInteger(int _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public long getLongInteger() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setLongInteger(long _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public long getDateTime() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setDateTime(long _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public byte[] getBlob() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void setBlob(byte[] _value) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel parcel, int i) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.hardware.security.keymint;
|
||||
|
||||
public @interface KeyPurpose {
|
||||
int AGREE_KEY = 6;
|
||||
int ATTEST_KEY = 7;
|
||||
int DECRYPT = 1;
|
||||
int ENCRYPT = 0;
|
||||
int SIGN = 2;
|
||||
int VERIFY = 3;
|
||||
int WRAP_KEY = 5;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.hardware.security.keymint;
|
||||
|
||||
public @interface SecurityLevel {
|
||||
int KEYSTORE = 100;
|
||||
int SOFTWARE = 0;
|
||||
int STRONGBOX = 2;
|
||||
int TRUSTED_ENVIRONMENT = 1;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.hardware.security.keymint;
|
||||
|
||||
public @interface Tag {
|
||||
int INVALID = 0;
|
||||
int PURPOSE = 536870913;
|
||||
int ALGORITHM = 268435458;
|
||||
int KEY_SIZE = 805306371;
|
||||
int BLOCK_MODE = 536870916;
|
||||
int DIGEST = 536870917;
|
||||
int PADDING = 536870918;
|
||||
int CALLER_NONCE = 1879048199;
|
||||
int MIN_MAC_LENGTH = 805306376;
|
||||
int EC_CURVE = 268435466;
|
||||
int RSA_PUBLIC_EXPONENT = 1342177480;
|
||||
int INCLUDE_UNIQUE_ID = 1879048394;
|
||||
int RSA_OAEP_MGF_DIGEST = 536871115;
|
||||
int BOOTLOADER_ONLY = 1879048494;
|
||||
int ROLLBACK_RESISTANCE = 1879048495;
|
||||
int HARDWARE_TYPE = 268435760;
|
||||
int EARLY_BOOT_ONLY = 1879048497;
|
||||
int ACTIVE_DATETIME = 1610613136;
|
||||
int ORIGINATION_EXPIRE_DATETIME = 1610613137;
|
||||
int USAGE_EXPIRE_DATETIME = 1610613138;
|
||||
int MIN_SECONDS_BETWEEN_OPS = 805306771;
|
||||
int MAX_USES_PER_BOOT = 805306772;
|
||||
int USAGE_COUNT_LIMIT = 805306773;
|
||||
int USER_ID = 805306869;
|
||||
int USER_SECURE_ID = -1610612234;
|
||||
int NO_AUTH_REQUIRED = 1879048695;
|
||||
int USER_AUTH_TYPE = 268435960;
|
||||
int AUTH_TIMEOUT = 805306873;
|
||||
int ALLOW_WHILE_ON_BODY = 1879048698;
|
||||
int TRUSTED_USER_PRESENCE_REQUIRED = 1879048699;
|
||||
int TRUSTED_CONFIRMATION_REQUIRED = 1879048700;
|
||||
int UNLOCKED_DEVICE_REQUIRED = 1879048701;
|
||||
int APPLICATION_ID = -1879047591;
|
||||
int APPLICATION_DATA = -1879047492;
|
||||
int CREATION_DATETIME = 1610613437;
|
||||
int ORIGIN = 268436158;
|
||||
int ROOT_OF_TRUST = -1879047488;
|
||||
int OS_VERSION = 805307073;
|
||||
int OS_PATCHLEVEL = 805307074;
|
||||
int UNIQUE_ID = -1879047485;
|
||||
int ATTESTATION_CHALLENGE = -1879047484;
|
||||
int ATTESTATION_APPLICATION_ID = -1879047483;
|
||||
int ATTESTATION_ID_BRAND = -1879047482;
|
||||
int ATTESTATION_ID_DEVICE = -1879047481;
|
||||
int ATTESTATION_ID_PRODUCT = -1879047480;
|
||||
int ATTESTATION_ID_SERIAL = -1879047479;
|
||||
int ATTESTATION_ID_IMEI = -1879047478;
|
||||
int ATTESTATION_ID_MEID = -1879047477;
|
||||
int ATTESTATION_ID_MANUFACTURER = -1879047476;
|
||||
int ATTESTATION_ID_MODEL = -1879047475;
|
||||
int VENDOR_PATCHLEVEL = 805307086;
|
||||
int BOOT_PATCHLEVEL = 805307087;
|
||||
int DEVICE_UNIQUE_ATTESTATION = 1879048912;
|
||||
int IDENTITY_CREDENTIAL_KEY = 1879048913;
|
||||
int STORAGE_KEY = 1879048914;
|
||||
int ATTESTATION_ID_SECOND_IMEI = -1879047469;
|
||||
int ASSOCIATED_DATA = -1879047192;
|
||||
int NONCE = -1879047191;
|
||||
int MAC_LENGTH = 805307371;
|
||||
int RESET_SINCE_ID_ROTATION = 1879049196;
|
||||
int CONFIRMATION_TOKEN = -1879047187;
|
||||
int CERTIFICATE_SERIAL = -2147482642;
|
||||
int CERTIFICATE_SUBJECT = -1879047185;
|
||||
int CERTIFICATE_NOT_BEFORE = 1610613744;
|
||||
int CERTIFICATE_NOT_AFTER = 1610613745;
|
||||
int MAX_BOOT_LEVEL = 805307378;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.os;
|
||||
|
||||
public class ServiceManager {
|
||||
public static IBinder getService(String name) {
|
||||
throw new UnsupportedOperationException("STUB!");
|
||||
}
|
||||
|
||||
public static void addService(String name, IBinder binder) {
|
||||
throw new UnsupportedOperationException("STUB!");
|
||||
}
|
||||
|
||||
public static IBinder checkService(String name) {
|
||||
throw new UnsupportedOperationException("STUB!");
|
||||
}
|
||||
|
||||
public static String[] listServices() {
|
||||
throw new UnsupportedOperationException("STUB!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.os;
|
||||
|
||||
public class SystemProperties {
|
||||
public static String get(String key, String def) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security;
|
||||
|
||||
public class Credentials {
|
||||
public static final String APP_SOURCE_CERTIFICATE = "FSV_";
|
||||
public static final String CA_CERTIFICATE = "CACERT_";
|
||||
public static final String CERTIFICATE_USAGE_APP_SOURCE = "appsrc";
|
||||
public static final String CERTIFICATE_USAGE_CA = "ca";
|
||||
public static final String CERTIFICATE_USAGE_USER = "user";
|
||||
public static final String CERTIFICATE_USAGE_WIFI = "wifi";
|
||||
public static final String EXTENSION_CER = ".cer";
|
||||
public static final String EXTENSION_CRT = ".crt";
|
||||
public static final String EXTENSION_P12 = ".p12";
|
||||
public static final String EXTENSION_PFX = ".pfx";
|
||||
public static final String EXTRA_CA_CERTIFICATES_DATA = "ca_certificates_data";
|
||||
public static final String EXTRA_CERTIFICATE_USAGE = "certificate_install_usage";
|
||||
public static final String EXTRA_INSTALL_AS_UID = "install_as_uid";
|
||||
public static final String EXTRA_PRIVATE_KEY = "PKEY";
|
||||
public static final String EXTRA_PUBLIC_KEY = "KEY";
|
||||
public static final String EXTRA_USER_CERTIFICATE_DATA = "user_certificate_data";
|
||||
public static final String EXTRA_USER_KEY_ALIAS = "user_key_pair_name";
|
||||
public static final String EXTRA_USER_PRIVATE_KEY_DATA = "user_private_key_data";
|
||||
public static final String INSTALL_ACTION = "android.credentials.INSTALL";
|
||||
public static final String INSTALL_AS_USER_ACTION = "android.credentials.INSTALL_AS_USER";
|
||||
public static final String LOCKDOWN_VPN = "LOCKDOWN_VPN";
|
||||
private static final String LOGTAG = "Credentials";
|
||||
public static final String PLATFORM_VPN = "PLATFORM_VPN_";
|
||||
public static final String USER_CERTIFICATE = "USRCERT_";
|
||||
public static final String USER_PRIVATE_KEY = "USRPKEY_";
|
||||
public static final String USER_SECRET_KEY = "USRSKEY_";
|
||||
public static final String VPN = "VPN_";
|
||||
public static final String WIFI = "WIFI_";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security;
|
||||
|
||||
public class KeyStore {
|
||||
public static final int CANNOT_ATTEST_IDS = -66;
|
||||
public static final int CONFIRMATIONUI_ABORTED = 2;
|
||||
public static final int CONFIRMATIONUI_CANCELED = 1;
|
||||
public static final int CONFIRMATIONUI_IGNORED = 4;
|
||||
public static final int CONFIRMATIONUI_OK = 0;
|
||||
public static final int CONFIRMATIONUI_OPERATION_PENDING = 3;
|
||||
public static final int CONFIRMATIONUI_SYSTEM_ERROR = 5;
|
||||
public static final int CONFIRMATIONUI_UIERROR = 65536;
|
||||
public static final int CONFIRMATIONUI_UIERROR_MALFORMED_UTF8_ENCODING = 65539;
|
||||
public static final int CONFIRMATIONUI_UIERROR_MESSAGE_TOO_LONG = 65538;
|
||||
public static final int CONFIRMATIONUI_UIERROR_MISSING_GLYPH = 65537;
|
||||
public static final int CONFIRMATIONUI_UNEXPECTED = 7;
|
||||
public static final int CONFIRMATIONUI_UNIMPLEMENTED = 6;
|
||||
public static final int FLAG_CRITICAL_TO_DEVICE_ENCRYPTION = 8;
|
||||
public static final int FLAG_ENCRYPTED = 1;
|
||||
public static final int FLAG_NONE = 0;
|
||||
public static final int FLAG_SOFTWARE = 2;
|
||||
public static final int FLAG_STRONGBOX = 16;
|
||||
public static final int HARDWARE_TYPE_UNAVAILABLE = -68;
|
||||
public static final int KEY_ALREADY_EXISTS = 16;
|
||||
public static final int KEY_NOT_FOUND = 7;
|
||||
public static final int KEY_PERMANENTLY_INVALIDATED = 17;
|
||||
public static final int LOCKED = 2;
|
||||
public static final int NO_ERROR = 1;
|
||||
public static final int OP_AUTH_NEEDED = 15;
|
||||
public static final int PERMISSION_DENIED = 6;
|
||||
public static final int PROTOCOL_ERROR = 5;
|
||||
public static final int SYSTEM_ERROR = 4;
|
||||
private static final String TAG = "KeyStore";
|
||||
public static final int UID_SELF = -1;
|
||||
public static final int UNDEFINED_ACTION = 9;
|
||||
public static final int UNINITIALIZED = 3;
|
||||
public static final int VALUE_CORRUPTED = 8;
|
||||
public static final int WRONG_PASSWORD = 10;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security.keymaster;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class ExportResult implements Parcelable {
|
||||
public final byte[] exportData;
|
||||
public final int resultCode;
|
||||
|
||||
public ExportResult(int resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
this.exportData = new byte[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public static final Creator<ExportResult> CREATOR = new Creator<ExportResult>() {
|
||||
@Override
|
||||
public ExportResult createFromParcel(Parcel in) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExportResult[] newArray(int size) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security.keymaster;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class KeyCharacteristics implements Parcelable {
|
||||
public KeymasterArguments hwEnforced;
|
||||
public KeymasterArguments swEnforced;
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public static final Creator<KeyCharacteristics> CREATOR = new Creator<KeyCharacteristics>() {
|
||||
@Override
|
||||
public KeyCharacteristics createFromParcel(Parcel in) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyCharacteristics[] newArray(int size) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security.keymaster;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
abstract class KeymasterArgument implements Parcelable {
|
||||
public final int tag;
|
||||
|
||||
protected KeymasterArgument(int tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public static final Creator<KeymasterArgument> CREATOR = new Creator<KeymasterArgument>() {
|
||||
@Override
|
||||
public KeymasterArgument createFromParcel(Parcel in) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeymasterArgument[] newArray(int size) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security.keymaster;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class KeymasterArguments implements Parcelable {
|
||||
|
||||
private static final long UINT32_RANGE = 1L << 32;
|
||||
public static final long UINT32_MAX_VALUE = UINT32_RANGE - 1;
|
||||
|
||||
private static final BigInteger UINT64_RANGE = BigInteger.ONE.shiftLeft(64);
|
||||
public static final BigInteger UINT64_MAX_VALUE = UINT64_RANGE.subtract(BigInteger.ONE);
|
||||
|
||||
private List<KeymasterArgument> mArguments;
|
||||
|
||||
public static final @NonNull Parcelable.Creator<KeymasterArguments> CREATOR = new Parcelable.Creator<KeymasterArguments>() {
|
||||
@Override
|
||||
public KeymasterArguments createFromParcel(Parcel in) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeymasterArguments[] newArray(int size) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
};
|
||||
|
||||
public KeymasterArguments() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
private KeymasterArguments(Parcel in) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public void addEnum(int tag, int value) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public void addEnums(int tag, int... values) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public int getEnum(int tag, int defaultValue) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public List<Integer> getEnums(int tag) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
private void addEnumTag(int tag, int value) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
private int getEnumTagValue(KeymasterArgument arg) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public void addUnsignedInt(int tag, long value) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public long getUnsignedInt(int tag, long defaultValue) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public void addUnsignedLong(int tag, BigInteger value) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public List<BigInteger> getUnsignedLongs(int tag) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
private void addLongTag(int tag, BigInteger value) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
private BigInteger getLongTagValue(KeymasterArgument arg) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public void addBoolean(int tag) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public boolean getBoolean(int tag) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public void addBytes(int tag, byte[] value) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public byte[] getBytes(int tag, byte[] defaultValue) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public void addDate(int tag, Date value) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public void addDateIfNotNull(int tag, Date value) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public Date getDate(int tag, Date defaultValue) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
private KeymasterArgument getArgumentByTag(int tag) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public boolean containsTag(int tag) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public int size() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public void readFromParcel(Parcel in) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public static BigInteger toUint64(long value) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security.keymaster;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class KeymasterCertificateChain implements Parcelable {
|
||||
private List<byte[]> mCertificates;
|
||||
|
||||
public KeymasterCertificateChain() {
|
||||
this.mCertificates = null;
|
||||
}
|
||||
|
||||
public KeymasterCertificateChain(List<byte[]> mCertificates) {
|
||||
this.mCertificates = mCertificates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public static final Creator<KeymasterCertificateChain> CREATOR = new Creator<KeymasterCertificateChain>() {
|
||||
@Override
|
||||
public KeymasterCertificateChain createFromParcel(Parcel in) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeymasterCertificateChain[] newArray(int size) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security.keymaster;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public final class KeymasterDefs {
|
||||
|
||||
private KeymasterDefs() {
|
||||
}
|
||||
|
||||
// Tag types.
|
||||
public static final int KM_INVALID = 0 << 28;
|
||||
public static final int KM_ENUM = 1 << 28;
|
||||
public static final int KM_ENUM_REP = 2 << 28;
|
||||
public static final int KM_UINT = 3 << 28;
|
||||
public static final int KM_UINT_REP = 4 << 28;
|
||||
public static final int KM_ULONG = 5 << 28;
|
||||
public static final int KM_DATE = 6 << 28;
|
||||
public static final int KM_BOOL = 7 << 28;
|
||||
public static final int KM_BIGNUM = 8 << 28;
|
||||
public static final int KM_BYTES = 9 << 28;
|
||||
public static final int KM_ULONG_REP = 10 << 28;
|
||||
|
||||
// Tag values.
|
||||
public static final int KM_TAG_INVALID = KM_INVALID | 0;
|
||||
public static final int KM_TAG_PURPOSE = KM_ENUM_REP | 1;
|
||||
public static final int KM_TAG_ALGORITHM = KM_ENUM | 2;
|
||||
public static final int KM_TAG_KEY_SIZE = KM_UINT | 3;
|
||||
public static final int KM_TAG_BLOCK_MODE = KM_ENUM_REP | 4;
|
||||
public static final int KM_TAG_DIGEST = KM_ENUM_REP | 5;
|
||||
public static final int KM_TAG_PADDING = KM_ENUM_REP | 6;
|
||||
public static final int KM_TAG_CALLER_NONCE = KM_BOOL | 7;
|
||||
public static final int KM_TAG_MIN_MAC_LENGTH = KM_UINT | 8;
|
||||
|
||||
public static final int KM_TAG_RESCOPING_ADD = KM_ENUM_REP | 101;
|
||||
public static final int KM_TAG_RESCOPING_DEL = KM_ENUM_REP | 102;
|
||||
public static final int KM_TAG_BLOB_USAGE_REQUIREMENTS = KM_ENUM | 705;
|
||||
|
||||
public static final int KM_TAG_RSA_PUBLIC_EXPONENT = KM_ULONG | 200;
|
||||
public static final int KM_TAG_INCLUDE_UNIQUE_ID = KM_BOOL | 202;
|
||||
|
||||
public static final int KM_TAG_ACTIVE_DATETIME = KM_DATE | 400;
|
||||
public static final int KM_TAG_ORIGINATION_EXPIRE_DATETIME = KM_DATE | 401;
|
||||
public static final int KM_TAG_USAGE_EXPIRE_DATETIME = KM_DATE | 402;
|
||||
public static final int KM_TAG_MIN_SECONDS_BETWEEN_OPS = KM_UINT | 403;
|
||||
public static final int KM_TAG_MAX_USES_PER_BOOT = KM_UINT | 404;
|
||||
|
||||
public static final int KM_TAG_ALL_USERS = KM_BOOL | 500;
|
||||
public static final int KM_TAG_USER_ID = KM_UINT | 501;
|
||||
public static final int KM_TAG_USER_SECURE_ID = KM_ULONG_REP | 502;
|
||||
public static final int KM_TAG_NO_AUTH_REQUIRED = KM_BOOL | 503;
|
||||
public static final int KM_TAG_USER_AUTH_TYPE = KM_ENUM | 504;
|
||||
public static final int KM_TAG_AUTH_TIMEOUT = KM_UINT | 505;
|
||||
public static final int KM_TAG_ALLOW_WHILE_ON_BODY = KM_BOOL | 506;
|
||||
public static final int KM_TAG_TRUSTED_USER_PRESENCE_REQUIRED = KM_BOOL | 507;
|
||||
public static final int KM_TAG_TRUSTED_CONFIRMATION_REQUIRED = KM_BOOL | 508;
|
||||
public static final int KM_TAG_UNLOCKED_DEVICE_REQUIRED = KM_BOOL | 509;
|
||||
|
||||
public static final int KM_TAG_ALL_APPLICATIONS = KM_BOOL | 600;
|
||||
public static final int KM_TAG_APPLICATION_ID = KM_BYTES | 601;
|
||||
|
||||
public static final int KM_TAG_CREATION_DATETIME = KM_DATE | 701;
|
||||
public static final int KM_TAG_ORIGIN = KM_ENUM | 702;
|
||||
public static final int KM_TAG_ROLLBACK_RESISTANT = KM_BOOL | 703;
|
||||
public static final int KM_TAG_ROOT_OF_TRUST = KM_BYTES | 704;
|
||||
public static final int KM_TAG_UNIQUE_ID = KM_BYTES | 707;
|
||||
public static final int KM_TAG_ATTESTATION_CHALLENGE = KM_BYTES | 708;
|
||||
public static final int KM_TAG_ATTESTATION_ID_BRAND = KM_BYTES | 710;
|
||||
public static final int KM_TAG_ATTESTATION_ID_DEVICE = KM_BYTES | 711;
|
||||
public static final int KM_TAG_ATTESTATION_ID_PRODUCT = KM_BYTES | 712;
|
||||
public static final int KM_TAG_ATTESTATION_ID_SERIAL = KM_BYTES | 713;
|
||||
public static final int KM_TAG_ATTESTATION_ID_IMEI = KM_BYTES | 714;
|
||||
public static final int KM_TAG_ATTESTATION_ID_MEID = KM_BYTES | 715;
|
||||
public static final int KM_TAG_ATTESTATION_ID_MANUFACTURER = KM_BYTES | 716;
|
||||
public static final int KM_TAG_ATTESTATION_ID_MODEL = KM_BYTES | 717;
|
||||
public static final int KM_TAG_DEVICE_UNIQUE_ATTESTATION = KM_BOOL | 720;
|
||||
|
||||
public static final int KM_TAG_ASSOCIATED_DATA = KM_BYTES | 1000;
|
||||
public static final int KM_TAG_NONCE = KM_BYTES | 1001;
|
||||
public static final int KM_TAG_AUTH_TOKEN = KM_BYTES | 1002;
|
||||
public static final int KM_TAG_MAC_LENGTH = KM_UINT | 1003;
|
||||
|
||||
// Algorithm values.
|
||||
public static final int KM_ALGORITHM_RSA = 1;
|
||||
public static final int KM_ALGORITHM_EC = 3;
|
||||
public static final int KM_ALGORITHM_AES = 32;
|
||||
public static final int KM_ALGORITHM_3DES = 33;
|
||||
public static final int KM_ALGORITHM_HMAC = 128;
|
||||
|
||||
// Block modes.
|
||||
public static final int KM_MODE_ECB = 1;
|
||||
public static final int KM_MODE_CBC = 2;
|
||||
public static final int KM_MODE_CTR = 3;
|
||||
public static final int KM_MODE_GCM = 32;
|
||||
|
||||
// Padding modes.
|
||||
public static final int KM_PAD_NONE = 1;
|
||||
public static final int KM_PAD_RSA_OAEP = 2;
|
||||
public static final int KM_PAD_RSA_PSS = 3;
|
||||
public static final int KM_PAD_RSA_PKCS1_1_5_ENCRYPT = 4;
|
||||
public static final int KM_PAD_RSA_PKCS1_1_5_SIGN = 5;
|
||||
public static final int KM_PAD_PKCS7 = 64;
|
||||
|
||||
// Digest modes.
|
||||
public static final int KM_DIGEST_NONE = 0;
|
||||
public static final int KM_DIGEST_MD5 = 1;
|
||||
public static final int KM_DIGEST_SHA1 = 2;
|
||||
public static final int KM_DIGEST_SHA_2_224 = 3;
|
||||
public static final int KM_DIGEST_SHA_2_256 = 4;
|
||||
public static final int KM_DIGEST_SHA_2_384 = 5;
|
||||
public static final int KM_DIGEST_SHA_2_512 = 6;
|
||||
|
||||
// Key origins.
|
||||
public static final int KM_ORIGIN_GENERATED = 0;
|
||||
public static final int KM_ORIGIN_IMPORTED = 2;
|
||||
public static final int KM_ORIGIN_UNKNOWN = 3;
|
||||
public static final int KM_ORIGIN_SECURELY_IMPORTED = 4;
|
||||
|
||||
// Key usability requirements.
|
||||
public static final int KM_BLOB_STANDALONE = 0;
|
||||
public static final int KM_BLOB_REQUIRES_FILE_SYSTEM = 1;
|
||||
|
||||
// Operation Purposes.
|
||||
public static final int KM_PURPOSE_ENCRYPT = 0;
|
||||
public static final int KM_PURPOSE_DECRYPT = 1;
|
||||
public static final int KM_PURPOSE_SIGN = 2;
|
||||
public static final int KM_PURPOSE_VERIFY = 3;
|
||||
public static final int KM_PURPOSE_WRAP = 5;
|
||||
|
||||
// Key formats.
|
||||
public static final int KM_KEY_FORMAT_X509 = 0;
|
||||
public static final int KM_KEY_FORMAT_PKCS8 = 1;
|
||||
public static final int KM_KEY_FORMAT_RAW = 3;
|
||||
|
||||
// User authenticators.
|
||||
public static final int HW_AUTH_PASSWORD = 1 << 0;
|
||||
public static final int HW_AUTH_BIOMETRIC = 1 << 1;
|
||||
|
||||
// Error codes.
|
||||
public static final int KM_ERROR_OK = 0;
|
||||
public static final int KM_ERROR_ROOT_OF_TRUST_ALREADY_SET = -1;
|
||||
public static final int KM_ERROR_UNSUPPORTED_PURPOSE = -2;
|
||||
public static final int KM_ERROR_INCOMPATIBLE_PURPOSE = -3;
|
||||
public static final int KM_ERROR_UNSUPPORTED_ALGORITHM = -4;
|
||||
public static final int KM_ERROR_INCOMPATIBLE_ALGORITHM = -5;
|
||||
public static final int KM_ERROR_UNSUPPORTED_KEY_SIZE = -6;
|
||||
public static final int KM_ERROR_UNSUPPORTED_BLOCK_MODE = -7;
|
||||
public static final int KM_ERROR_INCOMPATIBLE_BLOCK_MODE = -8;
|
||||
public static final int KM_ERROR_UNSUPPORTED_MAC_LENGTH = -9;
|
||||
public static final int KM_ERROR_UNSUPPORTED_PADDING_MODE = -10;
|
||||
public static final int KM_ERROR_INCOMPATIBLE_PADDING_MODE = -11;
|
||||
public static final int KM_ERROR_UNSUPPORTED_DIGEST = -12;
|
||||
public static final int KM_ERROR_INCOMPATIBLE_DIGEST = -13;
|
||||
public static final int KM_ERROR_INVALID_EXPIRATION_TIME = -14;
|
||||
public static final int KM_ERROR_INVALID_USER_ID = -15;
|
||||
public static final int KM_ERROR_INVALID_AUTHORIZATION_TIMEOUT = -16;
|
||||
public static final int KM_ERROR_UNSUPPORTED_KEY_FORMAT = -17;
|
||||
public static final int KM_ERROR_INCOMPATIBLE_KEY_FORMAT = -18;
|
||||
public static final int KM_ERROR_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM = -19;
|
||||
public static final int KM_ERROR_UNSUPPORTED_KEY_VERIFICATION_ALGORITHM = -20;
|
||||
public static final int KM_ERROR_INVALID_INPUT_LENGTH = -21;
|
||||
public static final int KM_ERROR_KEY_EXPORT_OPTIONS_INVALID = -22;
|
||||
public static final int KM_ERROR_DELEGATION_NOT_ALLOWED = -23;
|
||||
public static final int KM_ERROR_KEY_NOT_YET_VALID = -24;
|
||||
public static final int KM_ERROR_KEY_EXPIRED = -25;
|
||||
public static final int KM_ERROR_KEY_USER_NOT_AUTHENTICATED = -26;
|
||||
public static final int KM_ERROR_OUTPUT_PARAMETER_NULL = -27;
|
||||
public static final int KM_ERROR_INVALID_OPERATION_HANDLE = -28;
|
||||
public static final int KM_ERROR_INSUFFICIENT_BUFFER_SPACE = -29;
|
||||
public static final int KM_ERROR_VERIFICATION_FAILED = -30;
|
||||
public static final int KM_ERROR_TOO_MANY_OPERATIONS = -31;
|
||||
public static final int KM_ERROR_UNEXPECTED_NULL_POINTER = -32;
|
||||
public static final int KM_ERROR_INVALID_KEY_BLOB = -33;
|
||||
public static final int KM_ERROR_IMPORTED_KEY_NOT_ENCRYPTED = -34;
|
||||
public static final int KM_ERROR_IMPORTED_KEY_DECRYPTION_FAILED = -35;
|
||||
public static final int KM_ERROR_IMPORTED_KEY_NOT_SIGNED = -36;
|
||||
public static final int KM_ERROR_IMPORTED_KEY_VERIFICATION_FAILED = -37;
|
||||
public static final int KM_ERROR_INVALID_ARGUMENT = -38;
|
||||
public static final int KM_ERROR_UNSUPPORTED_TAG = -39;
|
||||
public static final int KM_ERROR_INVALID_TAG = -40;
|
||||
public static final int KM_ERROR_MEMORY_ALLOCATION_FAILED = -41;
|
||||
public static final int KM_ERROR_INVALID_RESCOPING = -42;
|
||||
public static final int KM_ERROR_IMPORT_PARAMETER_MISMATCH = -44;
|
||||
public static final int KM_ERROR_SECURE_HW_ACCESS_DENIED = -45;
|
||||
public static final int KM_ERROR_OPERATION_CANCELLED = -46;
|
||||
public static final int KM_ERROR_CONCURRENT_ACCESS_CONFLICT = -47;
|
||||
public static final int KM_ERROR_SECURE_HW_BUSY = -48;
|
||||
public static final int KM_ERROR_SECURE_HW_COMMUNICATION_FAILED = -49;
|
||||
public static final int KM_ERROR_UNSUPPORTED_EC_FIELD = -50;
|
||||
public static final int KM_ERROR_MISSING_NONCE = -51;
|
||||
public static final int KM_ERROR_INVALID_NONCE = -52;
|
||||
public static final int KM_ERROR_MISSING_MAC_LENGTH = -53;
|
||||
public static final int KM_ERROR_KEY_RATE_LIMIT_EXCEEDED = -54;
|
||||
public static final int KM_ERROR_CALLER_NONCE_PROHIBITED = -55;
|
||||
public static final int KM_ERROR_KEY_MAX_OPS_EXCEEDED = -56;
|
||||
public static final int KM_ERROR_INVALID_MAC_LENGTH = -57;
|
||||
public static final int KM_ERROR_MISSING_MIN_MAC_LENGTH = -58;
|
||||
public static final int KM_ERROR_UNSUPPORTED_MIN_MAC_LENGTH = -59;
|
||||
public static final int KM_ERROR_CANNOT_ATTEST_IDS = -66;
|
||||
public static final int KM_ERROR_DEVICE_LOCKED = -72;
|
||||
public static final int KM_ERROR_UNIMPLEMENTED = -100;
|
||||
public static final int KM_ERROR_VERSION_MISMATCH = -101;
|
||||
public static final int KM_ERROR_UNKNOWN_ERROR = -1000;
|
||||
|
||||
public static final Map<Integer, String> sErrorCodeToString = new HashMap<Integer, String>();
|
||||
static {
|
||||
sErrorCodeToString.put(KM_ERROR_OK, "OK");
|
||||
sErrorCodeToString.put(KM_ERROR_UNSUPPORTED_PURPOSE, "Unsupported purpose");
|
||||
sErrorCodeToString.put(KM_ERROR_INCOMPATIBLE_PURPOSE, "Incompatible purpose");
|
||||
sErrorCodeToString.put(KM_ERROR_UNSUPPORTED_ALGORITHM, "Unsupported algorithm");
|
||||
sErrorCodeToString.put(KM_ERROR_INCOMPATIBLE_ALGORITHM, "Incompatible algorithm");
|
||||
sErrorCodeToString.put(KM_ERROR_UNSUPPORTED_KEY_SIZE, "Unsupported key size");
|
||||
sErrorCodeToString.put(KM_ERROR_UNSUPPORTED_BLOCK_MODE, "Unsupported block mode");
|
||||
sErrorCodeToString.put(KM_ERROR_INCOMPATIBLE_BLOCK_MODE, "Incompatible block mode");
|
||||
sErrorCodeToString.put(KM_ERROR_UNSUPPORTED_MAC_LENGTH,
|
||||
"Unsupported MAC or authentication tag length");
|
||||
sErrorCodeToString.put(KM_ERROR_UNSUPPORTED_PADDING_MODE, "Unsupported padding mode");
|
||||
sErrorCodeToString.put(KM_ERROR_INCOMPATIBLE_PADDING_MODE, "Incompatible padding mode");
|
||||
sErrorCodeToString.put(KM_ERROR_UNSUPPORTED_DIGEST, "Unsupported digest");
|
||||
sErrorCodeToString.put(KM_ERROR_INCOMPATIBLE_DIGEST, "Incompatible digest");
|
||||
sErrorCodeToString.put(KM_ERROR_INVALID_EXPIRATION_TIME, "Invalid expiration time");
|
||||
sErrorCodeToString.put(KM_ERROR_INVALID_USER_ID, "Invalid user ID");
|
||||
sErrorCodeToString.put(KM_ERROR_INVALID_AUTHORIZATION_TIMEOUT,
|
||||
"Invalid user authorization timeout");
|
||||
sErrorCodeToString.put(KM_ERROR_UNSUPPORTED_KEY_FORMAT, "Unsupported key format");
|
||||
sErrorCodeToString.put(KM_ERROR_INCOMPATIBLE_KEY_FORMAT, "Incompatible key format");
|
||||
sErrorCodeToString.put(KM_ERROR_INVALID_INPUT_LENGTH, "Invalid input length");
|
||||
sErrorCodeToString.put(KM_ERROR_KEY_NOT_YET_VALID, "Key not yet valid");
|
||||
sErrorCodeToString.put(KM_ERROR_KEY_EXPIRED, "Key expired");
|
||||
sErrorCodeToString.put(KM_ERROR_KEY_USER_NOT_AUTHENTICATED, "Key user not authenticated");
|
||||
sErrorCodeToString.put(KM_ERROR_INVALID_OPERATION_HANDLE, "Invalid operation handle");
|
||||
sErrorCodeToString.put(KM_ERROR_VERIFICATION_FAILED, "Signature/MAC verification failed");
|
||||
sErrorCodeToString.put(KM_ERROR_TOO_MANY_OPERATIONS, "Too many operations");
|
||||
sErrorCodeToString.put(KM_ERROR_INVALID_KEY_BLOB, "Invalid key blob");
|
||||
sErrorCodeToString.put(KM_ERROR_INVALID_ARGUMENT, "Invalid argument");
|
||||
sErrorCodeToString.put(KM_ERROR_UNSUPPORTED_TAG, "Unsupported tag");
|
||||
sErrorCodeToString.put(KM_ERROR_INVALID_TAG, "Invalid tag");
|
||||
sErrorCodeToString.put(KM_ERROR_MEMORY_ALLOCATION_FAILED, "Memory allocation failed");
|
||||
sErrorCodeToString.put(KM_ERROR_UNSUPPORTED_EC_FIELD, "Unsupported EC field");
|
||||
sErrorCodeToString.put(KM_ERROR_MISSING_NONCE, "Required IV missing");
|
||||
sErrorCodeToString.put(KM_ERROR_INVALID_NONCE, "Invalid IV");
|
||||
sErrorCodeToString.put(KM_ERROR_CALLER_NONCE_PROHIBITED,
|
||||
"Caller-provided IV not permitted");
|
||||
sErrorCodeToString.put(KM_ERROR_INVALID_MAC_LENGTH,
|
||||
"Invalid MAC or authentication tag length");
|
||||
sErrorCodeToString.put(KM_ERROR_CANNOT_ATTEST_IDS, "Unable to attest device ids");
|
||||
sErrorCodeToString.put(KM_ERROR_DEVICE_LOCKED, "Device locked");
|
||||
sErrorCodeToString.put(KM_ERROR_UNIMPLEMENTED, "Not implemented");
|
||||
sErrorCodeToString.put(KM_ERROR_UNKNOWN_ERROR, "Unknown error");
|
||||
}
|
||||
|
||||
public static int getTagType(int tag) {
|
||||
return tag & (0xF << 28);
|
||||
}
|
||||
|
||||
public static String getErrorMessage(int errorCode) {
|
||||
String result = sErrorCodeToString.get(errorCode);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
return String.valueOf(errorCode);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security.keystore;
|
||||
|
||||
public class AndroidKeyStoreProvider {
|
||||
public static void install() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security.keystore;
|
||||
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.security.keymaster.KeymasterCertificateChain;
|
||||
|
||||
public interface IKeystoreCertificateChainCallback {
|
||||
void onFinished(KeystoreResponse keystoreResponse, KeymasterCertificateChain keymasterCertificateChain)
|
||||
throws RemoteException;
|
||||
|
||||
public static abstract class Stub {
|
||||
public static IKeystoreCertificateChainCallback asInterface(IBinder b) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security.keystore;
|
||||
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.security.keymaster.ExportResult;
|
||||
|
||||
public interface IKeystoreExportKeyCallback {
|
||||
void onFinished(ExportResult exportResult) throws RemoteException;
|
||||
|
||||
public static abstract class Stub {
|
||||
public static IKeystoreExportKeyCallback asInterface(IBinder b) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security.keystore;
|
||||
|
||||
import android.os.IBinder;
|
||||
import android.os.IInterface;
|
||||
import android.os.RemoteException;
|
||||
import android.security.keymaster.KeyCharacteristics;
|
||||
|
||||
public interface IKeystoreKeyCharacteristicsCallback extends IInterface {
|
||||
void onFinished(KeystoreResponse keystoreResponse, KeyCharacteristics keyCharacteristics) throws RemoteException;
|
||||
|
||||
public static abstract class Stub {
|
||||
public static IKeystoreKeyCharacteristicsCallback asInterface(IBinder b) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security.keystore;
|
||||
|
||||
public interface IKeystoreService {
|
||||
class Stub {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security.keystore;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class KeystoreResponse implements Parcelable {
|
||||
public final int error_code_;
|
||||
public final String error_msg_;
|
||||
|
||||
protected KeystoreResponse(int error_code, String error_msg) {
|
||||
this.error_code_ = error_code;
|
||||
this.error_msg_ = error_msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
public static final Creator<KeystoreResponse> CREATOR = new Creator<KeystoreResponse>() {
|
||||
@Override
|
||||
public KeystoreResponse createFromParcel(Parcel in) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeystoreResponse[] newArray(int size) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.security.keystore2;
|
||||
|
||||
public class AndroidKeyStoreProvider {
|
||||
public static void install() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.system.keystore2;
|
||||
|
||||
import android.hardware.security.keymint.KeyParameter;
|
||||
|
||||
public class Authorization {
|
||||
public KeyParameter keyParameter;
|
||||
public int securityLevel = 0;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.system.keystore2;
|
||||
|
||||
import android.hardware.security.keymint.KeyParameter;
|
||||
import android.os.IBinder;
|
||||
import android.os.IInterface;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public interface IKeystoreSecurityLevel extends IInterface {
|
||||
String DESCRIPTOR = "android.system.keystore2.IKeystoreSecurityLevel";
|
||||
|
||||
KeyMetadata generateKey(KeyDescriptor key, @Nullable KeyDescriptor attestationKey,
|
||||
KeyParameter[] params, int flags, byte[] entropy);
|
||||
|
||||
class Stub {
|
||||
public static IKeystoreSecurityLevel asInterface(IBinder b) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.system.keystore2;
|
||||
|
||||
import android.os.IBinder;
|
||||
|
||||
public interface IKeystoreService {
|
||||
String DESCRIPTOR = "android.system.keystore2.IKeystoreService";
|
||||
|
||||
IKeystoreSecurityLevel getSecurityLevel(int securityLevel);
|
||||
|
||||
class Stub {
|
||||
public static IKeystoreService asInterface(IBinder b) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.system.keystore2;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class KeyDescriptor implements Parcelable {
|
||||
public String alias;
|
||||
public byte[] blob;
|
||||
public int domain = 0;
|
||||
public long nspace = 0;
|
||||
|
||||
public static final Creator<KeyDescriptor> CREATOR = new Creator<KeyDescriptor>() {
|
||||
@Override
|
||||
public KeyDescriptor createFromParcel(Parcel in) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyDescriptor[] newArray(int size) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel parcel, int i) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.system.keystore2;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class KeyEntryResponse implements Parcelable {
|
||||
public IKeystoreSecurityLevel iSecurityLevel;
|
||||
public KeyMetadata metadata;
|
||||
|
||||
public static final Creator<KeyEntryResponse> CREATOR = new Creator<KeyEntryResponse>() {
|
||||
@Override
|
||||
public KeyEntryResponse createFromParcel(Parcel in) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyEntryResponse[] newArray(int size) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel parcel, int i) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package android.system.keystore2;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class KeyMetadata implements Parcelable {
|
||||
public Authorization[] authorizations;
|
||||
public byte[] certificate;
|
||||
public byte[] certificateChain;
|
||||
public KeyDescriptor key;
|
||||
public int keySecurityLevel = 0;
|
||||
public long modificationTimeMs = 0;
|
||||
|
||||
public static final Creator<KeyMetadata> CREATOR = new Creator<KeyMetadata>() {
|
||||
@Override
|
||||
public KeyMetadata createFromParcel(Parcel in) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyMetadata[] newArray(int size) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel parcel, int i) {
|
||||
throw new RuntimeException("");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user