本文整理汇总了Java中net.java.otr4j.crypto.OtrCryptoException类的典型用法代码示例。如果您正苦于以下问题:Java OtrCryptoException类的具体用法?Java OtrCryptoException怎么用?Java OtrCryptoException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OtrCryptoException类属于net.java.otr4j.crypto包,在下文中一共展示了OtrCryptoException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOtrFingerprint
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
public String getOtrFingerprint() {
if (this.otrFingerprint == null) {
try {
if (this.mOtrService == null) {
return null;
}
final PublicKey publicKey = this.mOtrService.getPublicKey();
if (publicKey == null || !(publicKey instanceof DSAPublicKey)) {
return null;
}
this.otrFingerprint = new OtrCryptoEngineImpl().getFingerprint(publicKey).toLowerCase(Locale.US);
return this.otrFingerprint;
} catch (final OtrCryptoException ignored) {
return null;
}
} else {
return this.otrFingerprint;
}
}
示例2: getOtrFingerprint
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
public String getOtrFingerprint() {
if (this.otrFingerprint == null) {
try {
if (this.mOtrService == null) {
return null;
}
final PublicKey publicKey = this.mOtrService.getPublicKey();
if (publicKey == null || !(publicKey instanceof DSAPublicKey)) {
return null;
}
this.otrFingerprint = new OtrCryptoEngineImpl().getFingerprint(publicKey);
return this.otrFingerprint;
} catch (final OtrCryptoException ignored) {
return null;
}
} else {
return this.otrFingerprint;
}
}
示例3: getOtrFingerprint
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
public String getOtrFingerprint() {
if (this.otrFingerprint == null) {
try {
if (this.mOtrService == null) {
return null;
}
final PublicKey publicKey = this.mOtrService.getPublicKey();
if (publicKey == null || !(publicKey instanceof DSAPublicKey)) {
return null;
}
this.otrFingerprint = new OtrCryptoEngineImpl().getFingerprint(publicKey).toLowerCase(Locale.US);
return this.otrFingerprint;
} catch (final OtrCryptoException ignored) {
return null;
}
} else {
return this.otrFingerprint;
}
}
示例4: getOtrFingerprint
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
public String getOtrFingerprint() {
if (this.otrFingerprint == null) {
try {
if (this.otrEngine == null) {
return null;
}
final PublicKey publicKey = this.otrEngine.getPublicKey();
if (publicKey == null || !(publicKey instanceof DSAPublicKey)) {
return null;
}
this.otrFingerprint = new OtrCryptoEngineImpl().getFingerprint(publicKey);
return this.otrFingerprint;
} catch (final OtrCryptoException ignored) {
return null;
}
} else {
return this.otrFingerprint;
}
}
示例5: getOtrFingerprint
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
public String getOtrFingerprint() {
if (this.otrFingerprint == null) {
try {
DSAPublicKey remotePubKey = (DSAPublicKey) getOtrSession()
.getRemotePublicKey();
StringBuilder builder = new StringBuilder(
new OtrCryptoEngineImpl().getFingerprint(remotePubKey));
builder.insert(8, " ");
builder.insert(17, " ");
builder.insert(26, " ");
builder.insert(35, " ");
this.otrFingerprint = builder.toString();
} catch (OtrCryptoException e) {
}
}
return this.otrFingerprint;
}
示例6: getOtrFingerprint
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
public String getOtrFingerprint() {
if (this.otrFingerprint == null) {
try {
DSAPublicKey pubkey = (DSAPublicKey) this.otrEngine.getPublicKey();
if (pubkey == null) {
return null;
}
StringBuilder builder = new StringBuilder(new OtrCryptoEngineImpl().getFingerprint(pubkey));
builder.insert(8, " ");
builder.insert(17, " ");
builder.insert(26, " ");
builder.insert(35, " ");
this.otrFingerprint = builder.toString();
} catch (OtrCryptoException e) {
}
}
return this.otrFingerprint;
}
示例7: getRemoteFingerprint
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
public String getRemoteFingerprint(String fullUserId) {
//if (!Address.hasResource(fullUserId))
// return null;
byte[] fingerprint = this.store.getPropertyHexBytes(fullUserId + ".fingerprint");
if (fingerprint != null) {
// If we have a fingerprint stashed, assume it is correct.
return new String(Hex.encode(fingerprint, 0, fingerprint.length));
}
PublicKey remotePublicKey = loadRemotePublicKeyFromStore(fullUserId);
if (remotePublicKey == null)
return null;
try {
// Store the fingerprint, for posterity.
String fingerprintString = new OtrCryptoEngineImpl().getFingerprint(remotePublicKey);
this.store.setPropertyHex(fullUserId + ".fingerprint", Hex.decode(fingerprintString));
store.save();
return fingerprintString;
} catch (OtrCryptoException e) {
OtrDebugLogger.log("OtrCryptoException getting remote fingerprint",e);
return null;
}
}
示例8: savePublicKey
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
public void savePublicKey(SessionID sessionID, PublicKey pubKey) {
if (sessionID == null)
return;
X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(pubKey.getEncoded());
String fullUserId = sessionID.getFullUserID();
// if (!Address.hasResource(fullUserId))
// return;
this.store.setProperty(fullUserId + ".publicKey", x509EncodedKeySpec.getEncoded());
// Stash the associated fingerprint. This saves calculating it in the future
// and is useful for transferring rosters to other apps.
try {
String fingerprintString = new OtrCryptoEngineImpl().getFingerprint(pubKey);
String verifiedToken = buildPublicKeyVerifiedId(fullUserId, fingerprintString.toLowerCase());
if (!this.store.hasProperty(verifiedToken))
this.store.setProperty(verifiedToken, false);
this.store.setPropertyHex(fullUserId + ".fingerprint", Hex.decode(fingerprintString));
store.save();
} catch (OtrCryptoException e) {
e.printStackTrace();
}
}
示例9: getLocalFingerprint
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
/**
*
* Returns the local finger print for specified session. If there is no
* finger print you might generate one.
*
* @return the local finger print for this sessionID
*/
public String getLocalFingerprint(SessionID sessionID) {
KeyPair keyPair = loadLocalKeyPair(sessionID);
if (keyPair == null)
return null;
PublicKey pubKey = keyPair.getPublic();
try {
return new OtrCryptoEngineImpl().getFingerprint(pubKey);
} catch (OtrCryptoException e) {
e.printStackTrace();
return null;
}
}
示例10: getLocalFingerprintRaw
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
public byte[] getLocalFingerprintRaw(SessionID sessionID) {
try {
return OtrCryptoEngine.getFingerprintRaw(getLocalKeyPair(sessionID)
.getPublic());
} catch (OtrCryptoException e) {
e.printStackTrace();
}
return null;
}
示例11: getOtrFingerprint
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
public synchronized String getOtrFingerprint() {
if (this.otrFingerprint == null) {
try {
if (getOtrSession() == null || getOtrSession().getSessionStatus() != SessionStatus.ENCRYPTED) {
return null;
}
DSAPublicKey remotePubKey = (DSAPublicKey) getOtrSession().getRemotePublicKey();
this.otrFingerprint = getAccount().getOtrService().getFingerprint(remotePubKey).toLowerCase(Locale.US);
} catch (final OtrCryptoException | UnsupportedOperationException ignored) {
return null;
}
}
return this.otrFingerprint;
}
示例12: getLocalFingerprintRaw
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
@Override
public byte[] getLocalFingerprintRaw(SessionID arg0) {
try {
return getFingerprintRaw(getPublicKey());
} catch (OtrCryptoException e) {
return null;
}
}
示例13: getOtrFingerprint
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
public synchronized String getOtrFingerprint() {
if (this.otrFingerprint == null) {
try {
if (getOtrSession() == null || getOtrSession().getSessionStatus() != SessionStatus.ENCRYPTED) {
return null;
}
DSAPublicKey remotePubKey = (DSAPublicKey) getOtrSession().getRemotePublicKey();
this.otrFingerprint = getAccount().getOtrService().getFingerprint(remotePubKey);
} catch (final OtrCryptoException | UnsupportedOperationException ignored) {
return null;
}
}
return this.otrFingerprint;
}
示例14: getLocalFingerprintRaw
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
/**
* @param sessionID
* @return -- Given a SessionID, return the local fingerprint
*/
@Override
public byte[] getLocalFingerprintRaw(SessionID sessionID) {
try {
return new OtrCryptoEngineImpl()
.getFingerprintRaw(getLocalKeyPair(sessionID)
.getPublic());
} catch (OtrCryptoException e) {
e.printStackTrace();
}
return null;
}
示例15: getOtrFingerprint
import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
public synchronized String getOtrFingerprint() {
if (this.otrFingerprint == null) {
try {
if (getOtrSession() == null || getOtrSession().getSessionStatus() != SessionStatus.ENCRYPTED) {
return null;
}
DSAPublicKey remotePubKey = (DSAPublicKey) getOtrSession().getRemotePublicKey();
this.otrFingerprint = getAccount().getOtrService().getFingerprint(remotePubKey).toLowerCase(Locale.US);
} catch (final OtrCryptoException | UnsupportedOperationException ignored) {
return null;
}
}
return this.otrFingerprint;
}