Exemple de démonstration de l'algorithme Taobao x-sign

   
   L'exemple de démonstration de l'algorithme Taobao x-sign
   utilise la méthode de crochet xposed pour obtenir la signature correspondante

    public String getMtopApiSign(HashMap<String, String> params, String appKey, String authCode) {         String instanceId = getInstanceId();         if (params == null) {             TBSdkLog.e("mtopsdk.InnerSignImpl", instanceId + " [getMtopApiSign] params is null.appKey=" + appKey);             renvoie nul ;         } else if (appKey == null) {             params.put("SG_ERROR_CODE", "AppKey is null");             TBSdkLog.e("mtopsdk.InnerSignImpl", instanceId + " [getMtopApiSign] AppKey est null.");             renvoie nul ;         } else if (this.sgMgr == null) {             params.put("SG_ERROR_CODE", "SGManager est null");










            TBSdkLog.e("mtopsdk.InnerSignImpl", instanceId + " [getMtopApiSign]SecurityGuardManager est nul, veuillez appeler ISign init()");
            renvoie nul ;
        } else {             essayez {                 SecurityGuardParamContext sgContext = new SecurityGuardParamContext();                 sgContext.appKey = appKey ;                 sgContext.requestType = 7 ;                 Map<String, String> paramsMap = convertInnerBaseStrMap(params, appKey);                 if (paramsMap != null && 2 == getEnv()) {                     paramsMap.put("ATLAS", "daily");                 }                 sgContext.paramMap = paramsMap ;









                renvoie this.sgMgr.getSecureSignatureComp().signRequest(sgContext, authCode);
            } catch (SecException e) {                 int errorCode = e.getErrorCode();                 kPt.commitStats("SignMtopRequest", String.valueOf(errorCode), "");                 params.put("SG_ERROR_CODE", String.valueOf(errorCode));                 TBSdkLog.e("mtopsdk.InnerSignImpl", instanceId + " [getMtopApiSign] ISecureSignatureComponent signRequest error, errorCode=" + errorCode, e);                 renvoie nul ;             } catch (Exception e2) {                 TBSdkLog.e("mtopsdk.InnerSignImpl", instanceId + " [getMtopApiSign] ISecureSignatureComponent signRequest error", e2);                 renvoie nul ;








            }
        }
    }

おすすめ

転載: blog.csdn.net/suiyuaneranLucy/article/details/126769367
おすすめ