|
| 1 | +\page VERIFY VERIFY Function |
| 2 | + |
| 3 | +```basic |
| 4 | +check = VERIFY(file$, sig$, cert$) |
| 5 | +``` |
| 6 | + |
| 7 | +Verifies a signed file against a detached signature and package signing certificate. |
| 8 | + |
| 9 | +The package certificate is validated against the built-in Retro Rocket package root certificate before the file signature is checked. |
| 10 | + |
| 11 | +Returns non-zero if the signature and certificate chain are valid, otherwise returns zero. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +### Examples |
| 16 | + |
| 17 | +```basic |
| 18 | +REM Verify a downloaded package |
| 19 | +
|
| 20 | +IF VERIFY("/ramdisk/editor.gz", "/ramdisk/editor.gz.sig", "/ramdisk/packages.pem") = TRUE THEN |
| 21 | + PRINT "Package verified" |
| 22 | +ELSE |
| 23 | + PRINT "Package verification failed" |
| 24 | +ENDIF |
| 25 | +``` |
| 26 | + |
| 27 | +```basic |
| 28 | +REM Refuse to install invalid packages |
| 29 | +
|
| 30 | +IF VERIFY(PKG$, SIG$, CERT$) THEN |
| 31 | + PRINT "Package is not trusted" |
| 32 | + END |
| 33 | +ENDIF |
| 34 | +``` |
| 35 | + |
| 36 | +--- |
| 37 | + |
| 38 | +### Notes |
| 39 | + |
| 40 | +* `file$` is the file to verify. |
| 41 | +* `sig$` is the detached package signature file. |
| 42 | +* `cert$` is the PEM package signing certificate. |
| 43 | +* Detached signatures are generated using \ref SIGNS "SIGN$". |
| 44 | +* The trusted package root certificate is loaded automatically from `/system/ssl/package_root_ca.pem`. |
| 45 | +* Detached signatures are expected to contain escaped binary signature data. |
| 46 | +* Verification checks: |
| 47 | + |
| 48 | + * certificate chain validity |
| 49 | + * certificate validity dates |
| 50 | + * detached Ed25519 signature validity |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +### Errors |
| 55 | + |
| 56 | +* File not found |
| 57 | +* Error reading file |
| 58 | +* Error reading signature |
| 59 | +* Error reading certificate |
| 60 | +* Error reading root certificate |
| 61 | +* Out of memory reading file |
| 62 | +* Out of memory reading signature |
| 63 | +* Out of memory reading certificate |
| 64 | +* Out of memory reading root certificate |
| 65 | + |
| 66 | +--- |
| 67 | + |
| 68 | +**See also:** |
| 69 | +\ref SIGNS "SIGN$" · \ref BINWRITE "BINWRITE" |
| 70 | + |
0 commit comments