【问题标题】:Tizen Secured companion samples are not workingTizen Secured 配套样本不工作
【发布时间】:2021-06-20 01:54:21
【问题描述】:

从这里下载源代码:https://developer.samsung.com/galaxy-watch-develop/samples/companion/hello-native.html

这里也试过:https://developer.samsung.com/galaxy-watch-develop/samples/companion/security-native.html

但无法在 Tizen 和 Android 之间获得“安全”套接字。

下面是一些来自 Android 的有用日志(这部分似乎失败了):

2021-03-23 18:21:37.903 10288-10365/com.samsung.android.sdk.accessory.example.provider D/AccessoryProvider(P): onAuthenticationResponse
2021-03-23 18:21:37.909 10288-10365/com.samsung.android.sdk.accessory.example.provider D/AccessoryProvider(P): onAuthenticationResponse: matched=false, authToken.getKey().length=294, myAppKey.length=162
2021-03-23 18:21:37.910 10288-10365/com.samsung.android.sdk.accessory.example.provider I/[SA_SDK]SAAgentV2: onAuthenticationResponse() -> AUTHENTICATION_SUCCESS

中间线是我的,问题是 SAP 给我的authTokenmyAppKey 不匹配。即使通过比较它们的大小也无法匹配。

所以,如果您对 authToken.getKey() 是什么以及它是什么类型的密钥(长度为 294 字节)有任何想法,请告诉我。

myAppKey 是这样构造的:

Signature[] sigs = pkgInfo.signatures;
Log.d(TAG, "getApplicationCertificate, sigs[0].toByteArray().length=" + sigs[0].toByteArray().length); //481

CertificateFactory cf = CertificateFactory.getInstance("X.509");
ByteArrayInputStream stream = new ByteArrayInputStream(sigs[0].toByteArray());
X509Certificate x509cert = X509Certificate.getInstance(stream);
myAppKey = x509cert.getPublicKey().getEncoded();
Log.d(TAG, "getApplicationCertificate, x509cert.getPublicKey().getEncoded().length=" + x509cert.getPublicKey().getEncoded().length); //162

【问题讨论】:

    标签: android signature tizen


    【解决方案1】:

    请使用以下链接下载安全示例应用程序。 https://developer.samsung.com/galaxy-watch-develop/samples/companion/security-native.html

    请仔细检查用于构建 Tizen 和 Android 应用程序的作者证书是否相同。

    【讨论】:

    • 谢谢。此示例不包含任何可构建的 Android 项目。
    【解决方案2】:

    解决方案是完全重新安装 Tizen 证书管理器

    添加新配置文件时并没有要求我在 TizenSamsung 之间进行选择,只是出于某种奇怪的原因直接选择了 Tizen。因此,我无法从导入的 Android 作者证书生成作者证书。

    重新安装后,按照SDK的指导,我成功了。

    【讨论】:

      猜你喜欢
      • 2013-05-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-04
      • 1970-01-01
      • 1970-01-01
      • 2012-01-12
      相关资源
      最近更新 更多