DAT - Data Access Token
Cargo.toml
dat = { version = "1.1.0" }
DAT
# Example
signature_algorithm: P256
crypto_algorithm: AES128GCMN
plain: 123
secure: asdf
# DAT result Example
1776530737.11.MTIz.8yKUvzs7mg3tDwdeA9I2gNOliewpTgm9OVbEY3Qh6io.qfnqmXKuNE3MfRr576rxNMCchxbY1iqC07-woJcbCudt2O0BAyK_86ypaSfLJjkGq9FZxpGrsgBDkk-xQhGvmA
expire.kid.plain.secure.sign
expire: number- Unix-Timestamp (sec)
kid: stringifiable- key id
plain: base64 url no pad- Text Data
secure: base64 url no pad- Encrypted Text Data
sign: base64 url no pad- dat-bank[kid].sign(expire.kid.plain.secure)
DAT KEY
# Example
1.2.P256.DErFl-U5h4fdbnAXTTs2GikkJgZwYXV25v2EdFeXIXs.AES128GCMN.5VEziIzCu2LRsK1XS6OYxA.1776541326.1776544626.1800
version.kid.signature-algorithm.signature-key.crypto-algorithm.crypto-key.issue-begin.issue-end.token-ttl
version: number- dat-key format version
kid: stringifiable- key id
signature-algorithm: text- sign algorithm
signature-key: base64 url no padThe signature-key is categorized into three types: FULL (signing-key~verifying-key), SIGNING (signing-key), and VERIFYING (~verifying-key).
Whether a key is for sign or verify can be distinguished by the presence of a leading tilde (~). Generally, if you output the sign key alone, the public key can be derived from it (using the private key). However, depending on the platform, this derivation feature may not be available; in such cases, you should output the full key and parse it for use.
- FULL: <signing key base64>~<verifying key base64>
- SIGNING: <signing key base64>
- VERIFYING: ~<verifying key base64>
crypto-algorithm: text- crypto algorithm,
crypto-key: base64 url no pad- crypto key
issue-begin: number- issue begin time
issue-end: number- issue end time
token-ttl: number- token(dat) TTL
support signature algorithm
| name | algorithm |
|---|---|
| P256 | secp256r1 |
| P384 | secp384r1 |
| P521 | secp521r1 |
support crypto algorithm
| name | algorithm |
|---|---|
| AES128GCMN | aes-128-gcm n(nonce + body) |
| AES256GCMN | aes-256-cbc n(nonce + body) |
Performance
- random plain and secure test
- mac mini m4 2024 basic (10 core)
- release compile
- dat_performance_test.rs
Testing started at 8:08 PM ...
Finished `release` profile [optimized] target(s) in 0.04s
Running tests/dat_performance_test.rs (target/release/deps/dat_performance_test-eb2999636e4fca0c)
performance test (plain, secure)
plain: JgdyFBoKMKAeimHifSZLjXnSywHAoGPES0YezJORfs8Ya6XNzuQuMmuGeHoZFwndBqKd1KFG0UzCNZeEnoD14zWMdl7i5stVWbvd
secure: QqaB7VoTQi1BXjB8N7nG9tO9aoQFo3KgE5GwbIOrEVm45YFTHx0HPmtAvrHeAOSJGSPa68AVylSUQVp0n62ZiXaYijMC4GF1Zb35
P256/AES128GCMN to_dat * 1000 : 16ms
P256/AES128GCMN to_payload * 1000 : 24ms
P256/AES256GCMN to_dat * 1000 : 15ms
P256/AES256GCMN to_payload * 1000 : 24ms
P384/AES128GCMN to_dat * 1000 : 66ms
P384/AES128GCMN to_payload * 1000 : 91ms
P384/AES256GCMN to_dat * 1000 : 63ms
P384/AES256GCMN to_payload * 1000 : 103ms
P521/AES128GCMN to_dat * 1000 : 50ms
P521/AES128GCMN to_payload * 1000 : 75ms
P521/AES256GCMN to_dat * 1000 : 43ms
P521/AES256GCMN to_payload * 1000 : 83ms