public static String getFingerprint(Contact contact, String localeCode) throws GeneralSecurityException { String[] wordList = I2PBote.getInstance().getWordList(localeCode); Fingerprint fingerprint = contact.getFingerprint(); return fingerprint==null ? null : fingerprint.getWords(wordList); }
public static String getFingerprint(EmailIdentity identity, String localeCode) throws GeneralSecurityException { String[] wordList = I2PBote.getInstance().getWordList(localeCode); Fingerprint fingerprint = identity.getFingerprint(); return fingerprint==null ? null : fingerprint.getWords(wordList); }
@Test public void toByteArrayAndBack() throws IOException, GeneralSecurityException { WordListAnchor wordLists = new WordListAnchor(); String[] wordListEN = wordLists.getWordList("en"); String[] wordListDE = wordLists.getWordList("de"); byte[] arrayA = contact.toByteArray(); Contact contact2 = new Contact(arrayA); assertEquals(contact.getName(), contact2.getName()); assertEquals(contact.getDestination().toBase64(), contact2.getDestination().toBase64()); assertEquals(contact.getText(), contact2.getText()); assertEquals(contact.getFingerprint().getWords(wordListDE), contact2.getFingerprint().getWords(wordListDE)); assertEquals(contact.getFingerprint().getWords(wordListEN), contact2.getFingerprint().getWords(wordListEN)); assertFalse(contact.getFingerprint().getWords(wordListEN).equals(contact2.getFingerprint().getWords(wordListDE))); assertEquals(contact.getPictureBase64(), contact2.getPictureBase64()); byte[] arrayB = contact2.toByteArray(); assertArrayEquals("The two arrays differ!", arrayA, arrayB); }