0

我正在为 JSON pandora 非官方 API 编写客户端,并在尝试登录时得到错误代码 0。我可以使用 auth.partnerLogin 获取 partnerAuthToken。我解密 syncTime 并保存当前系统时间的偏移量。我的请求和响应如下所示。

{"username":"android","password":"AC7IBG09A3DTSYM4R41UJWL07VLN8JI7","deviceModel":"android-generic","version":"5"}
{"stat":"ok","result":{"stationSkipLimit":6,"partnerId":"42","partnerAuthToken":"VA7Yw5kD1IhUnYogvweA4/FLfFVgRZGX5u","syncTime":"c93c75f71bafb052a18de3b6845cb273","deviceProperties":{"optionalFeatures":{"optionalFeature":[{"feature":"useAudioProxy2","enabled":"false","platformVersionRange":{"low":"4.0","high":"5.0.0"},"productVersionRange":{"low":"1.6","high":"*"}}]},"adRefreshInterval":5,"videoAdUniqueInterval":0,"videoAdRefreshInterval":840,"videoAdStartInterval":180,"ooyala":{"videoAdLoadingTimeout":2,"videoAdBufferRetryCount":3,"streamingPercentage":0,"streamingWhitelist":[534051315],"videoAdPlayTimeout":8}},"stationSkipUnit":"hour"}}

然后我发送用户身份验证请求:

{"loginType":"user","username":"abcd","password":"1234","partnerAuthToken":"VA7Yw5kD1IhUnYogvweA4%2FFLfFVgRZGX5u","syncTime":1387125618}

我在 ECB 模式下使用 blowish 对其进行编码并转换为十六进制代码:

ca86701e8a812dbece89c027ebd95b3217bfee29765b44edf488ddb3d692b9d4c033af64bc62584aa8405eab9c8582d1f374731f7604392d66ed61e73ab5bb4519b3133a6c7f0a4fa6ba8ad6f7140ca157679bce761e628842dc23de75b5840af1b9d2c5a5b265793ccf0c7fda2a7fad7f487c9de42658f57b47696fc586e06215d8cb6d46a7e8208894c052e40a950c

我得到的回应是:

{"stat":"fail","message":"An unexpected error occurred","code":0}

我的加密/解密密码是通过以下方式启动的:

try {
    m_encrypt = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
    m_encrypt.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(keys.getEncryptKey().getBytes(), "Blowfish"));
    m_decrypt = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
    m_decrypt.init(Cipher.DECRYPT_MODE, new SecretKeySpec(keys.getDecryptKey().getBytes(), "Blowfish"));
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
    e.printStackTrace();
} catch (InvalidKeyException e) {
    e.printStackTrace();
}

根据非官方 API 网站,错误代码 0 是内部错误

4

1 回答 1

0

我发现了问题。我的解密密钥是正确的,但我的加密密钥缺少一个字母。

于 2013-12-15T20:11:30.190 回答