Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/src/main/java/com/tailscale/ipn/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class App : UninitializedApp(), libtailscale.AppContext, ViewModelStoreOwner {
// Check if a directory URI has already been stored.
val storedUri = getStoredDirectoryUri()
val rm = getSystemService(Context.RESTRICTIONS_SERVICE) as RestrictionsManager
val hardwareAttestation = rm.applicationRestrictions.getBoolean(MDMSettings.KEY_HARDWARE_ATTESTATION, false)
val hardwareAttestation = rm.applicationRestrictions.getBoolean(MDMSettings.KEY_HARDWARE_ATTESTATION, true)
if (storedUri != null && storedUri.toString().startsWith("content://")) {
startLibtailscale(storedUri.toString(), hardwareAttestation)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: BSD-3-Clause
package com.tailscale.ipn.util

import android.content.pm.PackageManager
import android.os.Build
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyProperties
Expand All @@ -18,7 +17,13 @@ class HardwareKeysNotSupported : Exception("hardware-backed keys are not support
// HardwareKeyStore implements the callbacks necessary to implement key.HardwareAttestationKey on
// the Go side. It uses KeyStore with a StrongBox processor.
class HardwareKeyStore() {
var keyStoreKeys = HashMap<String, KeyPair>();
// keyStoreKeys should be a singleton. Even if multiple HardwareKeyStores are created, we should
// not create distinct underlying key maps.
companion object {
val keyStoreKeys: HashMap<String, KeyPair> by lazy {
HashMap<String, KeyPair>()
}
}
val keyStore: KeyStore = KeyStore.getInstance("AndroidKeyStore").apply {
load(null)
}
Expand Down
2 changes: 1 addition & 1 deletion libtailscale/keystore.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (k *hardwareAttestationKey) fetchPublic() error {

pubRaw, err := k.appCtx.HardwareAttestationKeyPublic(k.id)
if err != nil {
return fmt.Errorf("loading public key from KeyStore: %w", err)
return fmt.Errorf("loading public key for id %q from KeyStore: %w", k.id, err)
}
pubAny, err := x509.ParsePKIXPublicKey(pubRaw)
if err != nil {
Expand Down