AesToken.java

  1. package com.foxinmy.weixin4j.util;

  2. import java.io.Serializable;

  3. /**
  4.  * aes & token
  5.  *
  6.  * @className AesToken
  7.  * @author jinyu(foxinmy@gmail.com)
  8.  * @date 2015年5月6日
  9.  * @since JDK 1.6
  10.  * @see
  11.  */
  12. public class AesToken implements Serializable {

  13.     private static final long serialVersionUID = -6001008896414323534L;

  14.     /**
  15.      * 账号ID(原始id/appid/corpid)
  16.      */
  17.     private String weixinId;
  18.     /**
  19.      * 开发者的token
  20.      */
  21.     private String token;
  22.     /**
  23.      * 安全模式下的加密密钥
  24.      */
  25.     private String aesKey;

  26.     /**
  27.      * 一般为明文模式
  28.      *
  29.      * @param token
  30.      *            开发者的Token
  31.      */
  32.     public AesToken(String token) {
  33.         this(null, token, null);
  34.     }

  35.     /**
  36.      * 一般为AES加密模式
  37.      *
  38.      * @param weixinId
  39.      *            公众号的应用ID(原始id/appid/corpid)
  40.      * @param token
  41.      *            开发者Token
  42.      * @param aesKey
  43.      *            解密的EncodingAESKey
  44.      */
  45.     public AesToken(String weixinId, String token, String aesKey) {
  46.         this.weixinId = weixinId;
  47.         this.token = token;
  48.         this.aesKey = aesKey;
  49.     }

  50.     public String getWeixinId() {
  51.         return weixinId;
  52.     }

  53.     public String getToken() {
  54.         return token;
  55.     }

  56.     public String getAesKey() {
  57.         return aesKey;
  58.     }

  59.     @Override
  60.     public String toString() {
  61.         return "AesToken [weixinId=" + weixinId + ", token=" + token
  62.                 + ", aesKey=" + aesKey + "]";
  63.     }
  64. }