> For the complete documentation index, see [llms.txt](https://ref.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ref.gitbook.io/notes/java-card/untitled.md).

# \_FIXVALS\_

*qrpixels:*

![](/files/-MAlWP1GrDZneyIu1Stq)

*create\_card\_with\_face:*

![](/files/-MAlFE-mmaLY1nx-YziU)

```cpp
unsigned char encryptionKey[] = {
  0xf8, 0x0b, 0x95, 0x79, 0x69, 0xd1, 0xe8, 0x60, 0x6c, 0x33, 0x56, 0x00,
  0x76, 0x31, 0xe9, 0x2d, 0x14, 0x79, 0x9d, 0x65, 0x1f, 0x35, 0x0f, 0x89,
  0x87, 0x7c, 0x05, 0xa0, 0x3e, 0xc5, 0xaa, 0x3e
}; // 32

unsigned char signature_skpk[] = {
  0x2d, 0x52, 0xf8, 0x6a, 0xaa, 0x4d, 0x62, 0xfc,
  0xab, 0x4d, 0xb0, 0x0a, 0x21, 0x1a, 0x12, 0x60,
  0xf8, 0x17, 0xc5, 0xf2, 0xba, 0xb7, 0x3e, 0xfe,
  0xd6, 0x36, 0x07, 0xbc, 0x9d, 0xb3, 0x96, 0xee,
  
  0x57, 0xc6, 0x33, 0x09, 0xfa, 0xc2, 0x1b, 0x60,
  0x04, 0x76, 0x4e, 0xf6, 0xf7, 0xc6, 0x2f, 0x28,
  0xcf, 0x63, 0x40, 0xbe, 0x13, 0x10, 0x6e, 0x80,
  0xed, 0x70, 0x41, 0x8f, 0xa1, 0xb9, 0x27, 0xb4
}; // 64
```

*Keys generation:*

```cpp
unsigned char encryptionKey[crypto_aead_chacha20poly1305_IETF_KEYBYTES];
unsigned char signature_skpk[crypto_sign_SECRETKEYBYTES];
unsigned char signature_pk[crypto_sign_PUBLICKEYBYTES];
unsigned char verification_pk[crypto_sign_PUBLICKEYBYTES];

crypto_aead_chacha20poly1305_ietf_keygen(encryptionKey);
crypto_sign_keypair(signature_pk, signature_sk);
crypto_sign_ed25519_sk_to_pk(verification_pk, signature_skpk); 
```

*My debug constants:*

```
signaturekey = Bytes.parseHex("6f5c8615214d20a93fab64f705ee07da9d1356287de231fe25e2ef02c8ea0c1a8bf065b106115f13956ebff29b8cdc33ffc36399122b064d493de19da31fca9a").array();
verificationkeys = Bytes.parseHex("8bf065b106115f13956ebff29b8cdc33ffc36399122b064d493de19da31fca9a").array();

```

```
ed25519_skpk:

6f 5c 86 15 21 4d 20 a9 -> sk
3f ab 64 f7 05 ee 07 da
9d 13 56 28 7d e2 31 fe
25 e2 ef 02 c8 ea 0c 1a
8b f0 65 b1 06 11 5f 13 -> pk
95 6e bf f2 9b 8c dc 33
ff c3 63 99 12 2b 06 4d
49 3d e1 9d a3 1f ca 9a 
```

```
6f5c8615214d20a93fab64f705ee07da9d1356287de231fe25e2ef02c8ea0c1a8bf065b106115f13956ebff29b8cdc33ffc36399122b064d493de19da31fca9a
```

```
x25519_pk:

d8 76 66 29 76 d7 ce 85
65 e9 34 f1 37 6b df b3
b4 d3 07 a4 6d bb cb 78
e7 69 99 e1 df 0c b0 5a  

x25519_sk:

f0 44 85 c4 cc c1 26 71
cd 11 84 dd 49 b5 0e 5d
fd b9 9c a5 ca ab 8b b2
08 2e 9c 5c a3 1d 58 4a
```

The yellow rectangle is the attached signature. The rest is the message.&#x20;

![Attached signature shows content in plain](/files/-MAY0-AlUKpb8sAIwzJC)

Photo 64/2 via Dlib of manny1.bmp:

![](/files/-MAcjMb6kxFRO8CwRuTY)

An `ed25519` secret key:

![](/files/-MAY9n8PcLn0qeE_xFRj)

AEAD IETF encryption nonce:

![](/files/-MAYASJsJn4gKJ8KzkSl)

The encrypted payload:

![AEAD IETF encrypted](/files/-MAYBN3QpO2Xu5IlR0FQ)

signer pub key:

![](/files/-MAYFjukszYNsDUIMrQs)

faceArray\[128]:

![manny1.bmp](/files/-MAciNE2I1SR7GEVWbPn)

![](/files/-MAcquHOsdpK3QJH3oPZ)

The top nastiest would be `BitSet + 1` and below is the second:

![](/files/-MAflIQih04gVjV5Qa-L)

It should be `ret >= 0.0` . The above bug would occur on test cases of exact same photo.&#x20;

**Array file I/O:**

```cpp
unsigned char buf[32];
struct stat st;
  
if (stat("file.dat", &st) == -1) {    
    std::ofstream outfile("file.dat", std::ios::out | std::ios::binary);      
    outfile.write(reinterpret_cast<const char*>(buf), sizeof buf);
    outfile.close();
} else {
    std::ifstream infile("file.dat", std::ios::in | std::ios::binary);  
    infile.read(reinterpret_cast<char*>(buf), sizeof buf);
}
```

C++ random number generation between 4 and 9 inclusive:

```cpp
#include <random>

std::random_device rd;
std::mt19937 re(rd());

std::uniform_int_distribution<int> r_4_9(4, 9);
```

Point Break:

![crash at 2955](/files/-MArc27_sLWL20PT9Qkf)

But the generated 2954 is no longer readable. The last generated readable is at 2953. ~~Both at **ECC\_LOW** and **ECC\_MEDIUM** have same crashing point and same last readable at 2953.~~

| ECC Level     | **Max bytes len readable** |
| ------------- | -------------------------- |
| ECC\_LOW      | 2953                       |
| ECC\_MEDIUM   | 2331                       |
| ECC\_QUARTILE | 1663                       |
| ECC\_HIGH     | 1273                       |
