🗒️
notes
  • Journal
  • URLs
  • Java Card
    • SCP02
    • Rapid Notes
    • _FIXVALS_
    • Mifare
    • Chain Of Trust
  • Encoding
    • CBEFF
    • Bytes
  • Snippets
    • JNI_OnLoad
  • float to byte[]
  • Protobuf
  • C/C++
    • Containers
    • Basics
    • JNI
    • gcov
    • Castings
  • chess
    • Untitled
  • Compression
    • Untitled
  • Snippets
    • Untitled
  • Build Systems
    • Maven
    • Windows
  • Gradle
  • CMake
  • Java
    • Untitled
    • Certificates
  • Android
    • Mifare
  • Python
    • ctypes
  • WebSub
    • References
  • Spring Boot
    • Form-based Authentication
    • Basic Access Authentication
    • JWT Authentication
  • QR Code
    • Denso QR Code
  • Philosophical Inquiry
    • First
  • XML
    • xmlstarlet
Powered by GitBook
On this page

Was this helpful?

  1. Java Card

_FIXVALS_

PreviousRapid NotesNextMifare

Last updated 4 years ago

Was this helpful?

qrpixels:

create_card_with_face:

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:

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.

Photo 64/2 via Dlib of manny1.bmp:

An ed25519 secret key:

AEAD IETF encryption nonce:

The encrypted payload:

signer pub key:

faceArray[128]:

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

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

Array file I/O:

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:

#include <random>

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

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

Point Break:

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

Attached signature shows content in plain
AEAD IETF encrypted
manny1.bmp
crash at 2955