MCPcopy Index your code
hub / github.com/ccxt/ccxt / toPrivateKey

Method toPrivateKey

java/lib/src/main/java/io/github/ccxt/base/Crypto.java:503–514  ·  view source on GitHub ↗
(Object secret)

Source from the content-addressed store, hash-verified

501 }
502
503 private static BigInteger toPrivateKey(Object secret) {
504 Object v = (secret);
505 if (v instanceof BigInteger bi) return bi;
506 if (v instanceof byte[] b) return new BigInteger(1, b);
507 if (v instanceof String s) {
508 String t = s.trim();
509 if (t.startsWith("0x")) return new BigInteger(t.substring(2), 16);
510 if (t.matches("^[0-9a-fA-F]+$")) return new BigInteger(t, 16);
511 if (t.matches("^[0-9]+$")) return new BigInteger(t, 10);
512 }
513 throw new IllegalArgumentException("Unsupported secret type: " + (v == null ? "null" : v.getClass().getName()));
514 }
515
516 private static KeyPair ecKeyPairFromRaw(String curveStdName, byte[] privBytes) throws Exception {
517 // var params = ECNamedCurveTable.getParameterSpec(curveStdName);

Callers 1

EcdsaMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected