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

Method es256Sign

java/lib/src/main/java/io/github/ccxt/base/Crypto.java:378–388  ·  view source on GitHub ↗
(String token, String pem)

Source from the content-addressed store, hash-verified

376 // ====================================================
377
378 static byte[] es256Sign(String token, String pem) {
379 try {
380 PrivateKey key = ecP256PrivateKeyFromPem(pem);
381 Signature sig = Signature.getInstance("SHA256withECDSAinP1363Format");
382 sig.initSign(key);
383 sig.update(token.getBytes(StandardCharsets.US_ASCII));
384 return sig.sign();
385 } catch (Exception e) {
386 throw new RuntimeException("ES256 signing failed: " + e.getMessage(), e);
387 }
388 }
389
390 private static PrivateKey ecP256PrivateKeyFromPem(String pem) throws Exception {
391 if (pem == null) throw new IllegalArgumentException("pem is null");

Callers 1

JwtMethod · 0.95

Calls 3

updateMethod · 0.45
signMethod · 0.45

Tested by

no test coverage detected