本文整理汇总了Java中org.andengine.util.preferences.exception.SecureSharedPreferencesException类的典型用法代码示例。如果您正苦于以下问题:Java SecureSharedPreferencesException类的具体用法?Java SecureSharedPreferencesException怎么用?Java SecureSharedPreferencesException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SecureSharedPreferencesException类属于org.andengine.util.preferences.exception包,在下文中一共展示了SecureSharedPreferencesException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encrypt
import org.andengine.util.preferences.exception.SecureSharedPreferencesException; //导入依赖的package包/类
protected String encrypt(final String pPlainText) throws SecureSharedPreferencesException {
byte[] secureValue;
try {
secureValue = SecureSharedPreferences.crypt(this.mEncryptCipher, pPlainText.getBytes(SecureSharedPreferences.CHARSET));
} catch (final UnsupportedEncodingException e) {
throw new SecureSharedPreferencesException(e);
}
final String secureValueEncoded = Base64.encodeToString(secureValue, Base64.NO_WRAP);
return secureValueEncoded;
}
示例2: decrypt
import org.andengine.util.preferences.exception.SecureSharedPreferencesException; //导入依赖的package包/类
protected String decrypt(final String pCipherText) {
final byte[] securedValue = Base64.decode(pCipherText, Base64.NO_WRAP);
final byte[] pValue = SecureSharedPreferences.crypt(this.mDecryptCipher, securedValue);
try {
return new String(pValue, SecureSharedPreferences.CHARSET);
} catch (final UnsupportedEncodingException e) {
throw new SecureSharedPreferencesException(e);
}
}
示例3: crypt
import org.andengine.util.preferences.exception.SecureSharedPreferencesException; //导入依赖的package包/类
protected static byte[] crypt(final Cipher pCipher, final byte[] pBytes) throws SecureSharedPreferencesException {
try {
return pCipher.doFinal(pBytes);
} catch (final Exception e) {
throw new SecureSharedPreferencesException(e);
}
}
示例4: SecureSharedPreferences
import org.andengine.util.preferences.exception.SecureSharedPreferencesException; //导入依赖的package包/类
public SecureSharedPreferences(final SharedPreferences pDelegate, final String pSecureKey) throws SecureSharedPreferencesException {
this(pDelegate, pSecureKey, true, true);
}