com.baidu.sapi2
类 DeviceCrypto

java.lang.Object
  继承者 com.baidu.sapi2.DeviceCrypto

public class DeviceCrypto
extends Object

作者:
chenhetong(chenhetong@baidu.com)

构造方法摘要
DeviceCrypto()
           
 
方法摘要
static String AES128Decrypt(String content, String secretKey)
          decrypt the given content with the secretKey through the AES-128 algorithm
static String AES128Encrypt(String content, String secretKey)
          encrypt the given content with the secretKey through the AES-128 algorithm
static String encryptDeviceId(String deviceId)
          encrypt the device_id with secretKey
static String getHexString(byte[] b)
          Convert byte[] to String
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

DeviceCrypto

public DeviceCrypto()
方法详细信息

getHexString

public static String getHexString(byte[] b)
Convert byte[] to String

参数:
b - byte[] source
返回:

encryptDeviceId

public static String encryptDeviceId(String deviceId)
encrypt the device_id with secretKey

参数:
deviceId -
返回:

AES128Encrypt

public static String AES128Encrypt(String content,
                                   String secretKey)
encrypt the given content with the secretKey through the AES-128 algorithm

参数:
content - the plain content wants to encrypt,the content encoding must be UTF-8
secretKey - the secret key ,the secretKey encoding must be UTF-8
返回:
the secret data encoded by base64

AES128Decrypt

public static String AES128Decrypt(String content,
                                   String secretKey)
decrypt the given content with the secretKey through the AES-128 algorithm

参数:
content - the plain content wants to encrypt,the content encoding must be UTF-8
secretKey - the secret key ,the secretKey encoding must be UTF-8
返回:
the secret data encoded by base64


Copyright © 2013. All Rights Reserved.