Commit deeda55
fix(shielded-invites): zeroize the one-time bearer spending key end-to-end (dashpay#4204)
Reviewer (thepastaclaw) key-hygiene blocker: the one-time Orchard bearer
spending key was copied into several plain, unsanitized buffers on both the
claim and generate paths.
Claim path — carry the key through `Zeroizing` from the FFI copy down through
the wallet layers instead of leaking a plain `[u8; 32]` at each hop:
- rs-platform-wallet-ffi: the `[u8; 32]` claim-key copy is now
`Zeroizing<[u8; 32]>` and moves (not copies) into the wallet layer.
- platform-wallet `identity_create_from_one_time_key` (both the
PlatformWallet method and the operations fn) now take
`Zeroizing<[u8; 32]>`; the key is scrubbed on drop, dereferenced only at
the single `SpendingKey::from_bytes` consumption point.
Generate path — wipe the transient native and JVM copies after handoff:
- rs-platform-wallet-ffi: explicitly zeroize the native `sk` after copying
it into the caller's `out_sk_32`.
- rs-unified-sdk-jni: hold the JNI `sk` and the combined 75-byte `out` blob
in `Zeroizing` buffers so both scrub on drop, including early returns.
- kotlin-sdk `generateOneTimeOrchardKey`: wipe the 75-byte JVM blob in a
`finally` once the two owned arrays have been sliced out.
Validated: cargo build + cargo test -p platform-wallet (493 pass) + cargo fmt;
:sdk:compileDebugKotlin succeeds.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 58bc609 commit deeda55
5 files changed
Lines changed: 33 additions & 14 deletions
File tree
- packages
- kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet
- rs-platform-wallet-ffi/src
- rs-platform-wallet/src/wallet
- shielded
- rs-unified-sdk-jni/src
packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt
Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2278 | 2278 | | |
2279 | 2279 | | |
2280 | 2280 | | |
2281 | | - | |
2282 | | - | |
2283 | | - | |
2284 | | - | |
2285 | | - | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
2286 | 2292 | | |
2287 | 2293 | | |
2288 | 2294 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
895 | 895 | | |
896 | 896 | | |
897 | 897 | | |
898 | | - | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
899 | 902 | | |
900 | 903 | | |
901 | 904 | | |
| |||
1589 | 1592 | | |
1590 | 1593 | | |
1591 | 1594 | | |
1592 | | - | |
| 1595 | + | |
1593 | 1596 | | |
1594 | 1597 | | |
1595 | 1598 | | |
| |||
1600 | 1603 | | |
1601 | 1604 | | |
1602 | 1605 | | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
1603 | 1609 | | |
1604 | 1610 | | |
1605 | 1611 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1129 | 1129 | | |
1130 | 1130 | | |
1131 | 1131 | | |
1132 | | - | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
1133 | 1135 | | |
1134 | 1136 | | |
1135 | 1137 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1578 | 1578 | | |
1579 | 1579 | | |
1580 | 1580 | | |
1581 | | - | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
1582 | 1584 | | |
1583 | 1585 | | |
1584 | 1586 | | |
| |||
1603 | 1605 | | |
1604 | 1606 | | |
1605 | 1607 | | |
1606 | | - | |
| 1608 | + | |
1607 | 1609 | | |
1608 | 1610 | | |
1609 | 1611 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
986 | 986 | | |
987 | 987 | | |
988 | 988 | | |
989 | | - | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
990 | 993 | | |
991 | 994 | | |
992 | 995 | | |
| |||
998 | 1001 | | |
999 | 1002 | | |
1000 | 1003 | | |
1001 | | - | |
1002 | | - | |
| 1004 | + | |
| 1005 | + | |
1003 | 1006 | | |
1004 | | - | |
| 1007 | + | |
1005 | 1008 | | |
1006 | 1009 | | |
1007 | 1010 | | |
| |||
0 commit comments