当前位置: 首页>>代码示例>>Java>>正文


Java OtrCryptoException类代码示例

本文整理汇总了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;
	}
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:20,代码来源:Account.java

示例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;
	}
}
 
开发者ID:xavierle,项目名称:messengerxmpp,代码行数:20,代码来源:Account.java

示例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;
    }
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:20,代码来源:Account.java

示例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;
	}
}
 
开发者ID:juanignaciomolina,项目名称:txtr,代码行数:20,代码来源:Account.java

示例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;
}
 
开发者ID:GitESS,项目名称:SyncChatAndroid,代码行数:19,代码来源:Conversation.java

示例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;
}
 
开发者ID:GitESS,项目名称:SyncChatAndroid,代码行数:20,代码来源:Account.java

示例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;
        }
    }
 
开发者ID:prive,项目名称:prive-android,代码行数:27,代码来源:OtrAndroidKeyManagerImpl.java

示例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();
    }
}
 
开发者ID:prive,项目名称:prive-android,代码行数:26,代码来源:OtrAndroidKeyManagerImpl.java

示例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;
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:23,代码来源:MyOtrKeyManager.java

示例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;
}
 
开发者ID:zom,项目名称:zombot-java,代码行数:10,代码来源:OtrEngineHostImpl.java

示例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;
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:15,代码来源:Conversation.java

示例12: getLocalFingerprintRaw

import net.java.otr4j.crypto.OtrCryptoException; //导入依赖的package包/类
@Override
public byte[] getLocalFingerprintRaw(SessionID arg0) {
	try {
		return getFingerprintRaw(getPublicKey());
	} catch (OtrCryptoException e) {
		return null;
	}
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:9,代码来源:OtrService.java

示例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;
}
 
开发者ID:xavierle,项目名称:messengerxmpp,代码行数:15,代码来源:Conversation.java

示例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;
}
 
开发者ID:DanielKrawisz,项目名称:Shufflepuff,代码行数:17,代码来源:OtrChannel.java

示例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;
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:15,代码来源:Conversation.java


注:本文中的net.java.otr4j.crypto.OtrCryptoException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。