MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / copyAndPad

Method copyAndPad

CodenameOne/src/com/codename1/security/Jwt.java:403–418  ·  view source on GitHub ↗
(byte[] src, int srcOff, int srcLen,
                                   byte[] dst, int dstOff, int dstLen)

Source from the content-addressed store, hash-verified

401 }
402
403 private static void copyAndPad(byte[] src, int srcOff, int srcLen,
404 byte[] dst, int dstOff, int dstLen) {
405 // Strip leading zero pad if any
406 while (srcLen > 0 && src[srcOff] == 0) {
407 srcOff++;
408 srcLen--;
409 }
410 if (srcLen > dstLen) {
411 throw new CryptoException("ECDSA coordinate too large");
412 }
413 int pad = dstLen - srcLen;
414 for (int i = 0; i < pad; i++) {
415 dst[dstOff + i] = 0;
416 }
417 System.arraycopy(src, srcOff, dst, dstOff + pad, srcLen);
418 }
419
420 private static byte[] joseToDerEcdsa(byte[] jose, int coordLen) {
421 if (jose.length != coordLen * 2) {

Callers 1

derToJoseEcdsaMethod · 0.95

Calls 1

arraycopyMethod · 0.95

Tested by

no test coverage detected