latchset / jose

C-language implementation of Javascript Object Signing and Encryption
Apache License 2.0
171 stars 48 forks source link

self tests are failing on Travis #13

Closed tiran closed 7 years ago

tiran commented 7 years ago

make check is failing on Travis, see https://travis-ci.org/tiran/pyjose/builds/164060691 . OpenSSLs test suite is passing.

==============================
   jose 4: ./test-suite.log
==============================

# TOTAL: 6
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  5
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: tests/rfc7515_A
=====================

+trap exit ERR
trap: ERR: bad trap
+prfx=./tests/vectors/rfc7515_A
+cmd/jose ver -i ./tests/vectors/rfc7515_A.1.jwsc -k ./tests/vectors/rfc7515_A.1.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7515_A.2.jwsc -k ./tests/vectors/rfc7515_A.2.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7515_A.3.jwsc -k ./tests/vectors/rfc7515_A.3.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7515_A.4.jwsc -k ./tests/vectors/rfc7515_A.4.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7515_A.6.jwsg -k ./tests/vectors/rfc7515_A.6.jwkset
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7515_A.6.jwsg -k ./tests/vectors/rfc7515_A.6.1.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7515_A.6.jwsg -k ./tests/vectors/rfc7515_A.6.2.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7515_A.6.jwsg -k ./tests/vectors/rfc7515_A.6.1.jwk ./tests/vectors/rfc7515_A.6.2.jwk
No signatures validated!
+cmd/jose ver -a -i ./tests/vectors/rfc7515_A.6.jwsg -k ./tests/vectors/rfc7515_A.6.jwkset
Signature validation failed!
+cmd/jose ver -a -i ./tests/vectors/rfc7515_A.6.jwsg -k ./tests/vectors/rfc7515_A.6.jwkset -k ./tests/vectors/rfc7515_A.1.jwk
Signature validation failed!
+cmd/jose ver -a -i ./tests/vectors/rfc7515_A.6.jwsg -k ./tests/vectors/rfc7515_A.6.1.jwk -k ./tests/vectors/rfc7515_A.6.2.jwk
Signature validation failed!
+cmd/jose ver -a -i ./tests/vectors/rfc7515_A.6.jwsg -k ./tests/vectors/rfc7515_A.6.1.jwk -k ./tests/vectors/rfc7515_A.6.2.jwk -k ./tests/vectors/rfc7515_A.1.jwk
Signature validation failed!
+cmd/jose ver -i ./tests/vectors/rfc7515_A.7.jwsf -k ./tests/vectors/rfc7515_A.7.jwk
No signatures validated!
FAIL tests/rfc7515_A (exit status: 1)

FAIL: tests/rfc7520_4
=====================

+trap exit ERR
trap: ERR: bad trap
+prfx=./tests/vectors/rfc7520_4
+cmd/jose ver -i ./tests/vectors/rfc7520_4.1.jwsc -k ./tests/vectors/rfc7520_4.1.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.1.jwsf -k ./tests/vectors/rfc7520_4.1.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.1.jwsg -k ./tests/vectors/rfc7520_4.1.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.2.jwsc -k ./tests/vectors/rfc7520_4.2.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.2.jwsf -k ./tests/vectors/rfc7520_4.2.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.2.jwsg -k ./tests/vectors/rfc7520_4.2.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.3.jwsc -k ./tests/vectors/rfc7520_4.3.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.3.jwsf -k ./tests/vectors/rfc7520_4.3.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.3.jwsg -k ./tests/vectors/rfc7520_4.3.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.4.jwsc -k ./tests/vectors/rfc7520_4.4.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.4.jwsf -k ./tests/vectors/rfc7520_4.4.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.4.jwsg -k ./tests/vectors/rfc7520_4.4.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.5.jwsc -d ./tests/vectors/rfc7520_4.5.payl -k ./tests/vectors/rfc7520_4.5.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.5.jwsf -d ./tests/vectors/rfc7520_4.5.payl -k ./tests/vectors/rfc7520_4.5.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.5.jwsg -d ./tests/vectors/rfc7520_4.5.payl -k ./tests/vectors/rfc7520_4.5.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.6.jwsc -k ./tests/vectors/rfc7520_4.6.jwk
Invalid JWS!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.6.jwsf -k ./tests/vectors/rfc7520_4.6.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.6.jwsg -k ./tests/vectors/rfc7520_4.6.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.7.jwsc -k ./tests/vectors/rfc7520_4.7.jwk
Invalid JWS!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.7.jwsf -k ./tests/vectors/rfc7520_4.7.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.7.jwsg -k ./tests/vectors/rfc7520_4.7.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.8.jwsg -k ./tests/vectors/rfc7520_4.8.jwkset
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.8.jwsg -k ./tests/vectors/rfc7520_4.8.1.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.8.jwsg -k ./tests/vectors/rfc7520_4.8.2.jwk
No signatures validated!
+cmd/jose ver -i ./tests/vectors/rfc7520_4.8.jwsg -k ./tests/vectors/rfc7520_4.8.3.jwk
No signatures validated!
FAIL tests/rfc7520_4 (exit status: 1)

FAIL: tests/rfc7520_5
=====================

+prfx=tests/vectors/rfc7520_5
+cmd/jose dec -i tests/vectors/rfc7520_5.1.jwec -k tests/vectors/rfc7520_5.1.jwk
Decryption failed!
+cat tests/vectors/rfc7520_5.1.pt
+test  == You can trust us to stick with you through thick and thin–to the bitter end. And you can trust us to keep any secret of yours–closer than you keep it yourself. But you cannot trust us to let you face trouble alone, and go off without a word. We are your friends, Frodo.
./tests/rfc7520_5: 5: test: unexpected operator
FAIL tests/rfc7520_5 (exit status: 2)

FAIL: tests/rfc7638
===================

+trap exit ERR
trap: ERR: bad trap
+cmd/jose thp -i tests/vectors/rfc7638_3.1.jwk -H sha256
Unsupported hash function!
jose pub -i JWK(Set) [-o JWK(Set)]

Calculates the JWK thumbprint.

    -i FILE,   --jwk=FILE       JWK or JWKSet input (file)
    -i -,      --jwk=-          JWK or JWKSet input (stdin)

    -H sha1,   --hash=sha1      Use SHA1 as the hash function
    -H sha224, --hash=sha224    Use SHA224 as the hash function
    -H sha256, --hash=sha256    Use SHA256 as the hash function
    -H sha384, --hash=sha384    Use SHA384 as the hash function
    -H sha512, --hash=sha512    Use SHA512 as the hash function

    -o FILE,   --output=FILE    JWK or JWKSet output (file)
    -o -,      --output=-       JWK or JWKSet output (stdout; default)

+cat tests/vectors/rfc7638_3.1.thp
+test  == NzbLsXh8uDCcd-6MNwXF4W_7noWXFZAfHkxZsRGC9Xs
./tests/rfc7638: 5: test: unexpected operator
FAIL tests/rfc7638 (exit status: 2)

FAIL: tests/jose
================

+ASIGN=RS256 RS384 RS512 ES256 ES384 ES512 PS256 PS384 PS512
+SSIGN=HS256 HS384 HS512
+AWRAP=ECDH-ES ECDH-ES+A128KW ECDH-ES+A192KW ECDH-ES+A256KW RSA1_5
+SWRAP=A128KW A192KW A256KW A128GCMKW A192GCMKW A256GCMKW
+SENCR=A128CBC-HS256 A192CBC-HS384 A256CBC-HS512 A128GCM A192GCM A256GCM
+tests/rsa_oaep
+AWRAP=ECDH-ES ECDH-ES+A128KW ECDH-ES+A192KW ECDH-ES+A256KW RSA1_5 RSA-OAEP RSA-OAEP-256
+mktemp -d
+tmpdir=/tmp/tmp.9p01yZzbya
./tests/jose: 15: ./tests/jose: Syntax error: "(" unexpected
FAIL tests/jose (exit status: 2)
npmccallum commented 7 years ago

Patches welcome. :)

tiran commented 7 years ago

I deployed my branch with jose list on Travis. The command shows that most algos are missing. I assume that libjose does not load the openssl and zlib libs for some reason:

jwk_type: EC, RSA, oct
jwk_op: [enc]wrapKey/unwrapKey, [enc]encrypt/decrypt, [sig]verify/sign
jwk_generator:
jwk_hasher:
jws_signer:
jwe_crypter:
jwe_wrapper: dir
jwe_zipper:
npmccallum commented 7 years ago

Probably because they are stripping the linking since we don't reference any symbols in the library. We probably need to come up with a long-term solution for this.

npmccallum commented 7 years ago

Sorry for the spam. All tests now pass in Travis CI.