Java Code Examples for org.jivesoftware.smack.util.StringUtils#UTF8

The following examples show how to use org.jivesoftware.smack.util.StringUtils#UTF8 . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IOCipherOmemoStore.java    From Zom-Android-XMPP with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean isTrustedOmemoIdentity(OmemoManager omemoManager, OmemoDevice device, OmemoFingerprint fingerprint) {
    File trustPath = hierarchy.getContactsTrustPath(omemoManager, device);
    try {
        String depositedFingerprint = new String(readBytes(trustPath), StringUtils.UTF8);

        return  depositedFingerprint.length() > 2
                && depositedFingerprint.charAt(0) == '1'
                && new OmemoFingerprint(depositedFingerprint.substring(2)).equals(fingerprint);
    } catch (IOException e) {
        return false;
    }
}
 
Example 2
Source File: IOCipherOmemoStore.java    From Zom-Android-XMPP with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean isDecidedOmemoIdentity(OmemoManager omemoManager, OmemoDevice device, OmemoFingerprint fingerprint) {
    File trustPath = hierarchy.getContactsTrustPath(omemoManager, device);
    try {
        String depositedFingerprint = new String(readBytes(trustPath), StringUtils.UTF8);

        return  depositedFingerprint.length() > 2
                && (depositedFingerprint.charAt(0) == '1' || depositedFingerprint.charAt(0) == '2')
                && new OmemoFingerprint(depositedFingerprint.substring(2)).equals(fingerprint);
    } catch (IOException e) {
        return false;
    }
}