我正在为JSON非官方API编写一个客户机,并在尝试登录时获得错误代码0。我可以把partnerAuthToken和auth.partnerLogin联系起来。我解密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}我在欧洲央行模式下使用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是一个内部错误。
发布于 2013-12-15 20:11:30
我发现了问题。我的解密密钥是正确的,但我的加密密钥丢失了一个字母。
https://stackoverflow.com/questions/20597001
复制相似问题