Skip to content

Commit aea9ea0

Browse files
mrosseelChris Kleeschulte
authored andcommitted
added maven pom file, moved files into maven dir structure, small changes due to bitcoinj 13
1 parent 2243bfe commit aea9ea0

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

src/main/java/controller/BitPay.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@
2121
import org.apache.http.util.EntityUtils;
2222
import org.bitcoinj.core.ECKey;
2323

24-
import java.io.IOException;
25-
import java.io.UnsupportedEncodingException;
26-
import java.net.URI;
27-
import java.net.URISyntaxException;
28-
import java.net.UnknownHostException;
29-
import java.util.Arrays;
30-
import java.util.Hashtable;
31-
import java.util.List;
24+
import com.fasterxml.jackson.core.JsonProcessingException;
25+
import com.fasterxml.jackson.core.type.TypeReference;
26+
import com.fasterxml.jackson.databind.JsonMappingException;
27+
import com.fasterxml.jackson.databind.JsonNode;
28+
import com.fasterxml.jackson.databind.ObjectMapper;
29+
import org.bitcoinj.core.ECKey;
3230

3331
public class BitPay {
3432

src/main/java/controller/KeyUtils.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@
1111
import java.net.URISyntaxException;
1212
import java.security.SecureRandom;
1313

14+
import org.bitcoinj.core.Base58;
15+
import org.bitcoinj.core.ECKey;
16+
import org.bitcoinj.core.ECKey.ECDSASignature;
17+
import org.bitcoinj.core.Sha256Hash;
18+
import org.bitcoinj.core.Utils;
19+
1420
public class KeyUtils {
1521

1622
final private static char[] hexArray = "0123456789abcdef".toCharArray();
1723
final private static String PRIV_KEY_FILENAME = "bitpay_private.key";
18-
private static URI privateKey;
1924

20-
public KeyUtils() {
21-
}
25+
public KeyUtils() {}
2226

23-
public static boolean privateKeyExists() {
27+
public static boolean privateKeyExists()
28+
{
2429
return new File(PRIV_KEY_FILENAME).exists();
2530
}
2631

@@ -143,6 +148,9 @@ public static String deriveSIN(ECKey ecKey) throws IllegalArgumentException {
143148
return Base58.encode(unencodedBytes);
144149
}
145150

151+
return encoded;
152+
}
153+
146154
public static String sign(ECKey key, String input) throws UnsupportedEncodingException {
147155
byte[] data = input.getBytes("UTF8");
148156

@@ -154,8 +162,9 @@ public static String sign(ECKey key, String input) throws UnsupportedEncodingExc
154162
return bytesToHex(bytes);
155163
}
156164

157-
private static int getHexVal(char hex) {
158-
int val = (int) hex;
165+
private static int getHexVal(char hex)
166+
{
167+
int val = (int)hex;
159168
return val - (val < 58 ? 48 : (val < 97 ? 55 : 87));
160169
}
161170

0 commit comments

Comments
 (0)