Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
* remove trailing "/" from base58 alphabet (initially added beacause …
Browse files Browse the repository at this point in the history
…I thought I had to decrypt master/config ...... my mistake)

* modify link regex to parse correctly syncany links
  • Loading branch information
vwiencek committed Sep 12, 2014
1 parent dbaf672 commit f072785
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
public class ConnectOperation extends AbstractInitOperation {
private static final Logger logger = Logger.getLogger(ConnectOperation.class.getSimpleName());

private static final Pattern LINK_PATTERN = Pattern.compile("^syncany://storage/1/(?:(not-encrypted/)(.+)|([^-]+/(.+)))$");
private static final Pattern LINK_PATTERN = Pattern.compile("^syncany://storage/1/(?:(not-encrypted/)(.+)|([^-]+)/(.+))$");
private static final int LINK_PATTERN_GROUP_NOT_ENCRYPTED_FLAG = 1;
private static final int LINK_PATTERN_GROUP_NOT_ENCRYPTED_ENCODED = 2;
private static final int LINK_PATTERN_GROUP_ENCRYPTED_MASTER_KEY_SALT = 3;
Expand Down Expand Up @@ -259,7 +259,7 @@ private ConfigTO createConfigTOFromLink(ConfigTO configTO, String link) throws S
String masterKeySaltStr = linkMatcher.group(LINK_PATTERN_GROUP_ENCRYPTED_MASTER_KEY_SALT);
String ciphertext = linkMatcher.group(LINK_PATTERN_GROUP_ENCRYPTED_ENCODED);

byte[] masterKeySalt = Base58.decode(masterKeySaltStr.split("/")[0]);
byte[] masterKeySalt = Base58.decode(masterKeySaltStr);
byte[] ciphertextBytes = Base58.decode(ciphertext);

boolean retryPassword = true;
Expand Down
2 changes: 1 addition & 1 deletion syncany-util/src/main/java/org/syncany/util/Base58.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
public class Base58 {

private static final String Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz/";
private static final String Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
private static final BigInteger Base58 = new BigInteger("58", 10);

public static String encode(byte[] indata) {
Expand Down

0 comments on commit f072785

Please sign in to comment.