-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import os | ||
import pytest | ||
|
||
from helper import run | ||
from conftest import have_openssl | ||
|
||
|
||
@pytest.mark.skipif(not have_openssl(), reason="Have no OPENSSL") | ||
def test_rauc_extract_signature(tmp_path): | ||
out, err, exitcode = run('rauc --keyring openssl-ca/dev-ca.pem' | ||
f' extract-signature good-bundle.raucb {tmp_path}/bundle.sig ') | ||
|
||
assert exitcode == 0 | ||
|
||
assert os.path.exists(f'{tmp_path}/bundle.sig') | ||
|
||
out, err, exitcode = run(f'openssl asn1parse -inform DER -in {tmp_path}/bundle.sig -noout') | ||
assert exitcode == 0 | ||
|
||
|
||
@pytest.mark.skipif(not have_openssl(), reason="Have no OPENSSL") | ||
def test_rauc_extract_signature_crypt(tmp_path): | ||
out, err, exitcode = run('rauc --keyring openssl-ca/dev-ca.pem' | ||
' --key openssl-enc/keys/rsa-4096/private-key-000.pem' | ||
f' extract-signature good-crypt-bundle-encrypted.raucb {tmp_path}/bundle.sig ') | ||
|
||
assert exitcode == 0 | ||
|
||
assert os.path.exists(f'{tmp_path}/bundle.sig') | ||
|
||
out, err, exitcode = run(f'openssl asn1parse -inform DER -in {tmp_path}/bundle.sig -noout') | ||
assert exitcode == 0 | ||
|
||
|
||
@pytest.mark.skipif(not have_openssl(), reason="Have no OPENSSL") | ||
def test_rauc_extract(tmp_path): | ||
out, err, exitcode = run('rauc --keyring openssl-ca/dev-ca.pem' | ||
f' extract good-bundle.raucb {tmp_path}/bundle-extract ') | ||
|
||
assert exitcode == 0 | ||
|
||
assert os.path.exists(f'{tmp_path}/bundle-extract/appfs.img') | ||
assert os.path.exists(f'{tmp_path}/bundle-extract/custom_handler.sh') | ||
assert os.path.exists(f'{tmp_path}/bundle-extract/hook.sh') | ||
assert os.path.exists(f'{tmp_path}/bundle-extract/manifest.raucm') | ||
assert os.path.exists(f'{tmp_path}/bundle-extract/rootfs.img') | ||
|
||
|
||
@pytest.mark.skipif(not have_openssl(), reason="Have no OPENSSL") | ||
def test_rauc_extract_crypt(tmp_path): | ||
out, err, exitcode = run('rauc --keyring openssl-ca/dev-ca.pem' | ||
' --key openssl-enc/keys/rsa-4096/private-key-000.pem' | ||
f' extract good-bundle.raucb {tmp_path}/bundle-extract ') | ||
|
||
assert exitcode == 0 | ||
|
||
assert os.path.exists(f'{tmp_path}/bundle-extract/appfs.img') | ||
assert os.path.exists(f'{tmp_path}/bundle-extract/custom_handler.sh') | ||
assert os.path.exists(f'{tmp_path}/bundle-extract/hook.sh') | ||
assert os.path.exists(f'{tmp_path}/bundle-extract/manifest.raucm') | ||
assert os.path.exists(f'{tmp_path}/bundle-extract/rootfs.img') |