com.sina.weibo.sdk.utils.MD5 Java Examples

The following examples show how to use com.sina.weibo.sdk.utils.MD5. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WidgetRequestParam.java    From letv with Apache License 2.0 6 votes vote down vote up
public void onCreateRequestParamBundle(Bundle data) {
    this.mAppPackage = this.mContext.getPackageName();
    if (!TextUtils.isEmpty(this.mAppPackage)) {
        this.mHashKey = MD5.hexdigest(Utility.getSign(this.mContext, this.mAppPackage));
    }
    data.putString("access_token", this.mToken);
    data.putString("source", this.mAppKey);
    data.putString(ShareRequestParam.REQ_PARAM_PACKAGENAME, this.mAppPackage);
    data.putString(ShareRequestParam.REQ_PARAM_KEY_HASH, this.mHashKey);
    data.putString(REQ_PARAM_ATTENTION_FUID, this.mAttentionFuid);
    data.putString(REQ_PARAM_COMMENT_TOPIC, this.mCommentTopic);
    data.putString(REQ_PARAM_COMMENT_CONTENT, this.mCommentContent);
    data.putString(REQ_PARAM_COMMENT_CATEGORY, this.mCommentCategory);
    WeiboCallbackManager manager = WeiboCallbackManager.getInstance(this.mContext);
    if (this.mAuthListener != null) {
        this.mAuthListenerKey = manager.genCallbackKey();
        manager.setWeiboAuthListener(this.mAuthListenerKey, this.mAuthListener);
        data.putString(AuthRequestParam.EXTRA_KEY_LISTENER, this.mAuthListenerKey);
    }
    if (this.mWidgetRequestCallback != null) {
        this.mWidgetRequestCallbackKey = manager.genCallbackKey();
        manager.setWidgetRequestCallback(this.mWidgetRequestCallbackKey, this.mWidgetRequestCallback);
        data.putString(EXTRA_KEY_WIDGET_CALLBACK, this.mWidgetRequestCallbackKey);
    }
}
 
Example #2
Source File: ShareRequestParam.java    From letv with Apache License 2.0 6 votes vote down vote up
public void onCreateRequestParamBundle(Bundle data) {
    if (this.mBaseRequest != null) {
        this.mBaseRequest.toBundle(data);
    }
    if (!TextUtils.isEmpty(this.mAppPackage)) {
        this.mHashKey = MD5.hexdigest(Utility.getSign(this.mContext, this.mAppPackage));
    }
    data.putString("access_token", this.mToken);
    data.putString("source", this.mAppKey);
    data.putString(REQ_PARAM_PACKAGENAME, this.mAppPackage);
    data.putString(REQ_PARAM_KEY_HASH, this.mHashKey);
    data.putString("_weibo_appPackage", this.mAppPackage);
    data.putString("_weibo_appKey", this.mAppKey);
    data.putInt("_weibo_flag", 538116905);
    data.putString("_weibo_sign", this.mHashKey);
    if (this.mAuthListener != null) {
        WeiboCallbackManager manager = WeiboCallbackManager.getInstance(this.mContext);
        this.mAuthListenerKey = manager.genCallbackKey();
        manager.setWeiboAuthListener(this.mAuthListenerKey, this.mAuthListener);
        data.putString(AuthRequestParam.EXTRA_KEY_LISTENER, this.mAuthListenerKey);
    }
}
 
Example #3
Source File: WbShareHandler.java    From LoginSharePay with Apache License 2.0 6 votes vote down vote up
private void sendBroadcast(Context context, String action, String key, String packageName, Bundle data) {
    Intent intent = new Intent(action);
    String appPackage = context.getPackageName();
    intent.putExtra("_weibo_sdkVersion", "0041005000");
    intent.putExtra("_weibo_appPackage", appPackage);
    intent.putExtra("_weibo_appKey", key);
    intent.putExtra("_weibo_flag", 538116905);
    intent.putExtra("_weibo_sign", MD5.hexdigest(Utility.getSign(context, appPackage)));
    if(!TextUtils.isEmpty(packageName)) {
        intent.setPackage(packageName);
    }

    if(data != null) {
        intent.putExtras(data);
    }

    context.sendBroadcast(intent, "com.sina.weibo.permission.WEIBO_SDK_PERMISSION");
}
 
Example #4
Source File: ApiUtils.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
public static boolean containSign(Signature asignature[], String s)
{
    if (asignature != null && s != null)
    {
        int i = asignature.length;
        int j = 0;
        while (j < i) 
        {
            if (s.equals(MD5.hexdigest(asignature[j].toByteArray())))
            {
                LogUtil.d("ApiUtils", "check pass");
                return true;
            }
            j++;
        }
    }
    return false;
}
 
Example #5
Source File: WeiboShareAPIImpl.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
private void sendBroadcast(Context context, String s, String s1, String s2, Bundle bundle)
{
    Intent intent = new Intent(s);
    String s3 = context.getPackageName();
    intent.putExtra("_weibo_sdkVersion", 22);
    intent.putExtra("_weibo_appPackage", s3);
    intent.putExtra("_weibo_appKey", s1);
    intent.putExtra("_weibo_flag", 0x20130329);
    intent.putExtra("_weibo_sign", MD5.hexdigest(Utility.getSign(context, s3)));
    if (!TextUtils.isEmpty(s2))
    {
        intent.setPackage(s2);
    }
    if (bundle != null)
    {
        intent.putExtras(bundle);
    }
    LogUtil.d("WeiboApiImpl", (new StringBuilder("intent=")).append(intent).append(", extra=").append(intent.getExtras()).toString());
    context.sendBroadcast(intent, "com.sina.weibo.permission.WEIBO_SDK_PERMISSION");
}
 
Example #6
Source File: WeiboShareAPIImpl.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private boolean shareWithWeibo(Activity activity, String s, String s1, String s2, Bundle bundle)
{
    if (activity == null || TextUtils.isEmpty(s) || TextUtils.isEmpty(s1) || TextUtils.isEmpty(s2))
    {
        LogUtil.e("ActivityHandler", "send fail, invalid arguments");
        return false;
    }
    Intent intent = new Intent();
    intent.setPackage(s1);
    intent.setAction(s);
    String s3 = activity.getPackageName();
    intent.putExtra("_weibo_sdkVersion", 22);
    intent.putExtra("_weibo_appPackage", s3);
    intent.putExtra("_weibo_appKey", s2);
    intent.putExtra("_weibo_flag", 0x20130329);
    intent.putExtra("_weibo_sign", MD5.hexdigest(Utility.getSign(activity, s3)));
    if (bundle != null)
    {
        intent.putExtras(bundle);
    }
    try
    {
        LogUtil.d("WeiboApiImpl", (new StringBuilder("intent=")).append(intent).append(", extra=").append(intent.getExtras()).toString());
        activity.startActivityForResult(intent, 765);
    }
    catch (ActivityNotFoundException activitynotfoundexception)
    {
        LogUtil.e("WeiboApiImpl", "Failed, target ActivityNotFound");
        return false;
    }
    return true;
}