diff --git a/src/cheogram/java/com/cheogram/android/BobTransfer.java b/src/cheogram/java/com/cheogram/android/BobTransfer.java index d6765d8601248a35f1f970b1dd21c61e1b17ec59..938fec45886341440822f7672023e2429d0115a7 100644 --- a/src/cheogram/java/com/cheogram/android/BobTransfer.java +++ b/src/cheogram/java/com/cheogram/android/BobTransfer.java @@ -13,6 +13,7 @@ import java.net.URISyntaxException; import java.security.NoSuchAlgorithmException; import io.ipfs.cid.Cid; +import io.ipfs.multihash.Multihash; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; @@ -57,7 +58,13 @@ public class BobTransfer implements Transferable { } public static URI uri(Cid cid) throws NoSuchAlgorithmException, URISyntaxException { - return new URI("cid", CryptoHelper.multihashAlgo(cid.getType()) + "+" + CryptoHelper.bytesToHex(cid.getHash()) + "@bob.xmpp.org", null); + return new URI("cid", multihashAlgo(cid.getType()) + "+" + CryptoHelper.bytesToHex(cid.getHash()) + "@bob.xmpp.org", null); + } + + private static String multihashAlgo(Multihash.Type type) throws NoSuchAlgorithmException { + final String algo = CryptoHelper.multihashAlgo(type); + if (algo.equals("sha-1")) return "sha1"; + return algo; } public BobTransfer(URI uri, Account account, Jid to, XmppConnectionService xmppConnectionService) { diff --git a/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java b/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java index 77f6565fa23f53190def7bd173e5418f9f3ec8ee..b9aafbadd529abb981f4bcd51ce2c56f9269ee92 100644 --- a/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java @@ -293,7 +293,7 @@ public final class CryptoHelper { public static String multihashAlgo(Multihash.Type type) throws NoSuchAlgorithmException { switch(type) { case sha1: - return "sha1"; + return "sha-1"; case sha2_256: return "sha-256"; case sha2_512: