本文整理汇总了Java中org.thoughtcrime.securesms.util.ParcelUtil.deserialize方法的典型用法代码示例。如果您正苦于以下问题:Java ParcelUtil.deserialize方法的具体用法?Java ParcelUtil.deserialize怎么用?Java ParcelUtil.deserialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.thoughtcrime.securesms.util.ParcelUtil
的用法示例。
在下文中一共展示了ParcelUtil.deserialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserialize
import org.thoughtcrime.securesms.util.ParcelUtil; //导入方法依赖的package包/类
@Override
public Job deserialize(EncryptionKeys keys, boolean encrypted, String serialized) throws IOException {
try {
String plaintext;
if (encrypted) {
MasterSecret masterSecret = ParcelUtil.deserialize(keys.getEncoded(), MasterSecret.CREATOR);
MasterCipher masterCipher = new MasterCipher(masterSecret);
plaintext = masterCipher.decryptBody(serialized);
} else {
plaintext = serialized;
}
return delegate.deserialize(keys, encrypted, plaintext);
} catch (InvalidMessageException e) {
throw new IOException(e);
}
}
示例2: serialize
import org.thoughtcrime.securesms.util.ParcelUtil; //导入方法依赖的package包/类
@Override
public String serialize(Job job) throws IOException {
String plaintext = delegate.serialize(job);
if (job.getEncryptionKeys() != null) {
MasterSecret masterSecret = ParcelUtil.deserialize(job.getEncryptionKeys().getEncoded(),
MasterSecret.CREATOR);
MasterCipher masterCipher = new MasterCipher(masterSecret);
return masterCipher.encryptBody(plaintext);
} else {
return plaintext;
}
}
示例3: onRun
import org.thoughtcrime.securesms.util.ParcelUtil; //导入方法依赖的package包/类
@Override
public void onRun() throws IOException {
MasterSecret masterSecret = ParcelUtil.deserialize(getEncryptionKeys().getEncoded(), MasterSecret.CREATOR);
if (TextSecurePreferences.isSignedPreKeyRegistered(context)) {
Log.w(TAG, "Signed prekey already registered...");
return;
}
IdentityKeyPair identityKeyPair = IdentityKeyUtil.getIdentityKeyPair(context, masterSecret);
SignedPreKeyRecord signedPreKeyRecord = PreKeyUtil.generateSignedPreKey(context, masterSecret, identityKeyPair);
accountManager.setSignedPreKey(signedPreKeyRecord);
TextSecurePreferences.setSignedPreKeyRegistered(context, true);
}