PasscodeEncryptionSupport

public final class PasscodeEncryptionSupport extends Object

用于使用 Nest 密码加密方案加密和解密密码的实用方法。

常量摘要

int kPasscodeEncryptionConfig1_TEST_ONLY 密码加密配置 1(仅限测试) 注意:此加密配置仅用于测试,不提供完整性或保密性。
int kPasscodeEncryptionConfig2 密码加密配置 2

字段摘要

public static final byte[] kPasscodeEncKeyDiversifier 用于派生密码加密和身份验证密钥的密钥多样化器。
public static final byte[] kPasscodeFingerprintKeyDiversifier 在派生密码指纹密钥时使用的密钥多样化器。

公共构造函数摘要

公共方法摘要

静态字符串
decryptPasscode(byte[] encryptedPasscode, byte[] encKey, byte[] authKey, byte[] fingerprintKey)
解密使用 Nest 密码加密方案加密的密码。
static byte[]
encryptPasscode(int config, int keyId, long nonce, String passcode, byte[] encKey, byte[] authKey, byte[] fingerprintKey)
使用 Nest 密码加密方案加密密码。
static int
getEncryptedPasscodeConfig(byte[] encryptedPasscode)
从加密的通行码中提取配置类型。
static byte[]
getEncryptedPasscodeFingerprint(byte[] encryptedPasscode)
从加密的通行码中提取指纹。
static int
getEncryptedPasscodeKeyId(byte[] encryptedPasscode)
从加密的通行码中提取密钥 ID。
static long
getEncryptedPasscodeNonce(byte[] encryptedPasscode)
从加密的通行码中提取随机数。
static boolean
isSupportedPasscodeEncryptionConfig(int config)
确定是否支持指定的密码加密配置。

继承的方法摘要

常量

public static final int kPasscodeEncryptionConfig1_TEST_ONLY

密码加密配置 1(仅限测试)注意:此加密配置仅用于测试,不提供完整性或保密性。配置 1 仅在开发 build 中可用。

常量值1

public static final int kPasscodeEncryptionConfig2

密码加密配置 2

常量值2

字段

public static final byte[] kPasscodeEncKeyDiversifier

在派生密码加密和身份验证密钥时使用的密钥多样化器。

public static final byte[] kPasscodeFingerprintKeyDiversifier

在派生密码指纹密钥时使用的密钥多样化器。

公共构造函数

public PasscodeEncryptionSupport ()

公共方法

public static String decryptPasscode (byte[] encryptedPasscode, byte[] encKey, byte[] authKey, byte[] fingerprintKey)

解密使用 Nest 密码加密方案加密的密码。

参数
encryptedPasscode
encKey
authKey
fingerprintKey

public static byte[] encryptPasscode (int config, int keyId, long nonce, String passcode, byte[] encKey, byte[] authKey, byte[] fingerprintKey)

使用 Nest 密码加密方案加密密码。

参数
config
keyId
nonce
密码
encKey
authKey
fingerprintKey

public static int getEncryptedPasscodeConfig (byte[] encryptedPasscode)

从加密的通行码中提取配置类型。

参数
encryptedPasscode

public static byte[] getEncryptedPasscodeFingerprint (byte[] encryptedPasscode)

从加密的密码中提取指纹。

参数
encryptedPasscode

public static int getEncryptedPasscodeKeyId (byte[] encryptedPasscode)

从加密的密码中提取密钥 ID。

参数
encryptedPasscode

public static long getEncryptedPasscodeNonce (byte[] encryptedPasscode)

从加密的通行码中提取随机数。

参数
encryptedPasscode

public static boolean isSupportedPasscodeEncryptionConfig (int config)

确定是否支持指定的密码加密配置。

参数
config