import typing

import android.app
import android.content
import android.net
import android.os
import java
import java.chaquopy
import java.lang
import java.math
import java.security
import java.security.cert
import java.security.spec
import java.util
import java.util.concurrent
import javax.security.auth.x500

class AppUriAuthenticationPolicy(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[AppUriAuthenticationPolicy]] = ...
    def describeContents(self) -> int: ...
    def equals(self, obj: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getAppAndUriMappings(self) -> java.util.Map[java.lang.String, java.util.Map[android.net.Uri, java.lang.String]]: ...
    def hashCode(self) -> int: ...
    def toString(self) -> str: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

    class Builder(java.lang.Object):
        def __init__(self) -> None: ...
        def addAppAndUriMapping(self, appPackageName: str | java.lang.String, uri: android.net.Uri, alias: str | java.lang.String, /) -> AppUriAuthenticationPolicy.Builder: ...
        def build(self) -> AppUriAuthenticationPolicy: ...

class AttestedKeyPair(java.lang.Object):
    def __init__(self, keyPair: java.security.KeyPair, attestationRecord: java.util.List[java.security.cert.Certificate], /) -> None: ...
    def getAttestationRecord(self) -> java.util.List[java.security.cert.Certificate]: ...
    def getKeyPair(self) -> java.security.KeyPair | None: ...

class ConfirmationAlreadyPresentingException(java.lang.Exception):
    @typing.overload
    def __init__(self) -> None: ...
    @typing.overload
    def __init__(self, message: str | java.lang.String, /) -> None: ...

class ConfirmationCallback(java.lang.Object):
    def __init__(self) -> None: ...
    def onCanceled(self) -> None: ...
    def onConfirmed(self, dataThatWasConfirmed: java.chaquopy.JavaArrayJByte, /) -> None: ...
    def onDismissed(self) -> None: ...
    def onError(self, e: java.lang.Throwable, /) -> None: ...

class ConfirmationNotAvailableException(java.lang.Exception):
    @typing.overload
    def __init__(self) -> None: ...
    @typing.overload
    def __init__(self, message: str | java.lang.String, /) -> None: ...

class ConfirmationPrompt(java.lang.Object):
    def cancelPrompt(self) -> None: ...
    @staticmethod
    def isSupported(context: android.content.Context, /) -> bool: ...
    def presentPrompt(self, executor: java.util.concurrent.Executor, callback: ConfirmationCallback, /) -> None: ...

    class Builder(java.lang.Object):
        def __init__(self, context: android.content.Context, /) -> None: ...
        def build(self) -> ConfirmationPrompt: ...
        def setExtraData(self, extraData: java.chaquopy.JavaArrayJByte, /) -> ConfirmationPrompt.Builder: ...
        def setPromptText(self, promptText: java.lang.CharSequence, /) -> ConfirmationPrompt.Builder: ...

class FileIntegrityManager(java.lang.Object):
    def isApkVeritySupported(self) -> bool: ...
    def isAppSourceCertificateTrusted(self, certificate: java.security.cert.X509Certificate, /) -> bool: ...

class KeyChain(java.lang.Object):
    ACTION_KEYCHAIN_CHANGED: typing.ClassVar[str] = ...
    ACTION_KEY_ACCESS_CHANGED: typing.ClassVar[str] = ...
    ACTION_STORAGE_CHANGED: typing.ClassVar[str] = ...
    ACTION_TRUST_STORE_CHANGED: typing.ClassVar[str] = ...
    EXTRA_CERTIFICATE: typing.ClassVar[str] = ...
    EXTRA_KEY_ACCESSIBLE: typing.ClassVar[str] = ...
    EXTRA_KEY_ALIAS: typing.ClassVar[str] = ...
    EXTRA_NAME: typing.ClassVar[str] = ...
    EXTRA_PKCS12: typing.ClassVar[str] = ...
    KEY_ALIAS_SELECTION_DENIED: typing.ClassVar[str] = ...
    def __init__(self) -> None: ...
    @typing.overload
    @staticmethod
    def choosePrivateKeyAlias(activity: android.app.Activity, response: KeyChainAliasCallback, keyTypes: java.chaquopy.JavaArray[java.lang.String], issuers: java.chaquopy.JavaArray[java.security.Principal], uri: android.net.Uri, alias: str | java.lang.String, /) -> None: ...
    @typing.overload
    @staticmethod
    def choosePrivateKeyAlias(activity: android.app.Activity, response: KeyChainAliasCallback, keyTypes: java.chaquopy.JavaArray[java.lang.String], issuers: java.chaquopy.JavaArray[java.security.Principal], host: str | java.lang.String, port: int | java.jint | java.lang.Integer, alias: str | java.lang.String, /) -> None: ...
    @staticmethod
    def createInstallIntent() -> android.content.Intent: ...
    @staticmethod
    def createManageCredentialsIntent(policy: AppUriAuthenticationPolicy, /) -> android.content.Intent: ...
    @staticmethod
    def getCertificateChain(context: android.content.Context, alias: str | java.lang.String, /) -> java.chaquopy.JavaArray[java.security.cert.X509Certificate] | None: ...
    @staticmethod
    def getCredentialManagementAppPolicy(context: android.content.Context, /) -> AppUriAuthenticationPolicy: ...
    @staticmethod
    def getPrivateKey(context: android.content.Context, alias: str | java.lang.String, /) -> java.security.PrivateKey | None: ...
    @staticmethod
    def isBoundKeyAlgorithm(algorithm: str | java.lang.String, /) -> bool: ...
    @staticmethod
    def isCredentialManagementApp(context: android.content.Context, /) -> bool: ...
    @staticmethod
    def isKeyAlgorithmSupported(algorithm: str | java.lang.String, /) -> bool: ...
    @staticmethod
    def removeCredentialManagementApp(context: android.content.Context, /) -> bool: ...

class KeyChainAliasCallback(java.lang.Object):
    def alias(self, arg1: str | java.lang.String, /) -> None: ...

class KeyChainException(java.lang.Exception):
    @typing.overload
    def __init__(self) -> None: ...
    @typing.overload
    def __init__(self, detailMessage: str | java.lang.String, /) -> None: ...
    @typing.overload
    def __init__(self, cause: java.lang.Throwable, /) -> None: ...
    @typing.overload
    def __init__(self, message: str | java.lang.String, cause: java.lang.Throwable, /) -> None: ...

class KeyPairGeneratorSpec(java.security.spec.AlgorithmParameterSpec):
    def getAlgorithmParameterSpec(self) -> java.security.spec.AlgorithmParameterSpec: ...
    def getContext(self) -> android.content.Context: ...
    def getEndDate(self) -> java.util.Date: ...
    def getKeySize(self) -> int: ...
    def getKeyType(self) -> str | None: ...
    def getKeystoreAlias(self) -> str: ...
    def getSerialNumber(self) -> java.math.BigInteger: ...
    def getStartDate(self) -> java.util.Date: ...
    def getSubjectDN(self) -> javax.security.auth.x500.X500Principal: ...
    def isEncryptionRequired(self) -> bool: ...

    class Builder(java.lang.Object):
        def __init__(self, context: android.content.Context, /) -> None: ...
        def build(self) -> KeyPairGeneratorSpec: ...
        def setAlgorithmParameterSpec(self, spec: java.security.spec.AlgorithmParameterSpec, /) -> KeyPairGeneratorSpec.Builder: ...
        def setAlias(self, alias: str | java.lang.String, /) -> KeyPairGeneratorSpec.Builder: ...
        def setEncryptionRequired(self) -> KeyPairGeneratorSpec.Builder: ...
        def setEndDate(self, endDate: java.util.Date, /) -> KeyPairGeneratorSpec.Builder: ...
        def setKeySize(self, keySize: int | java.jint | java.lang.Integer, /) -> KeyPairGeneratorSpec.Builder: ...
        def setKeyType(self, keyType: str | java.lang.String, /) -> KeyPairGeneratorSpec.Builder: ...
        def setSerialNumber(self, serialNumber: java.math.BigInteger, /) -> KeyPairGeneratorSpec.Builder: ...
        def setStartDate(self, startDate: java.util.Date, /) -> KeyPairGeneratorSpec.Builder: ...
        def setSubject(self, subject: javax.security.auth.x500.X500Principal, /) -> KeyPairGeneratorSpec.Builder: ...

class KeyStoreException(java.lang.Exception):
    ERROR_ATTESTATION_CHALLENGE_TOO_LARGE: typing.ClassVar[int] = ...
    ERROR_ATTESTATION_KEYS_UNAVAILABLE: typing.ClassVar[int] = ...
    ERROR_ID_ATTESTATION_FAILURE: typing.ClassVar[int] = ...
    ERROR_INCORRECT_USAGE: typing.ClassVar[int] = ...
    ERROR_INTERNAL_SYSTEM_ERROR: typing.ClassVar[int] = ...
    ERROR_KEYMINT_FAILURE: typing.ClassVar[int] = ...
    ERROR_KEYSTORE_FAILURE: typing.ClassVar[int] = ...
    ERROR_KEYSTORE_UNINITIALIZED: typing.ClassVar[int] = ...
    ERROR_KEY_CORRUPTED: typing.ClassVar[int] = ...
    ERROR_KEY_DOES_NOT_EXIST: typing.ClassVar[int] = ...
    ERROR_KEY_NOT_TEMPORALLY_VALID: typing.ClassVar[int] = ...
    ERROR_KEY_OPERATION_EXPIRED: typing.ClassVar[int] = ...
    ERROR_OTHER: typing.ClassVar[int] = ...
    ERROR_PERMISSION_DENIED: typing.ClassVar[int] = ...
    ERROR_UNIMPLEMENTED: typing.ClassVar[int] = ...
    ERROR_USER_AUTHENTICATION_REQUIRED: typing.ClassVar[int] = ...
    RETRY_AFTER_NEXT_REBOOT: typing.ClassVar[int] = ...
    RETRY_NEVER: typing.ClassVar[int] = ...
    RETRY_WHEN_CONNECTIVITY_AVAILABLE: typing.ClassVar[int] = ...
    RETRY_WITH_EXPONENTIAL_BACKOFF: typing.ClassVar[int] = ...
    def getNumericErrorCode(self) -> int: ...
    def getRetryPolicy(self) -> int: ...
    def isSystemError(self) -> bool: ...
    def isTransientFailure(self) -> bool: ...
    def requiresUserAuthentication(self) -> bool: ...
    def toString(self) -> str: ...

class KeyStoreParameter(java.security.KeyStore.ProtectionParameter):
    def isEncryptionRequired(self) -> bool: ...

    class Builder(java.lang.Object):
        def __init__(self, context: android.content.Context, /) -> None: ...
        def build(self) -> KeyStoreParameter: ...
        def setEncryptionRequired(self, required: bool | java.jboolean | java.lang.Boolean, /) -> KeyStoreParameter.Builder: ...

class NetworkSecurityPolicy(java.lang.Object):
    @staticmethod
    def getInstance() -> NetworkSecurityPolicy: ...
    def isCertificateTransparencyVerificationRequired(self, hostname: str | java.lang.String, /) -> bool: ...
    @typing.overload
    def isCleartextTrafficPermitted(self) -> bool: ...
    @typing.overload
    def isCleartextTrafficPermitted(self, hostname: str | java.lang.String, /) -> bool: ...
