diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2014-11-14 20:46:24 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2014-11-14 20:48:19 +0100 |
commit | b27f1ad7dbfd248d98bc54ab5969ea4429c6b92d (patch) | |
tree | b3a2a864c987805edfb408f6864af9a874679503 | |
parent | c73ef9293c2c13b40e4fad78ae367c77272a5395 (diff) | |
download | libtasn1-b27f1ad7dbfd248d98bc54ab5969ea4429c6b92d.tar.gz |
Added test for ResponseData decoding-encoding issue
-rw-r--r-- | tests/Makefile.am | 6 | ||||
-rw-r--r-- | tests/Test_choice.c | 2 | ||||
-rw-r--r-- | tests/ocsp.der | bin | 0 -> 163 bytes | |||
-rw-r--r-- | tests/pkix.asn | 46 |
4 files changed, 50 insertions, 4 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 79751f4..4b326f0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -27,7 +27,7 @@ EXTRA_DIST = Test_parser.asn Test_tree.asn Test_tree_asn1_tab.c \ TestIndef2.p12 TestIndef3.der # For crlf. -EXTRA_DIST += crlf.cer crl.der +EXTRA_DIST += crlf.cer crl.der ocsp.der dist_check_SCRIPTS = crlf benchmark dist_check_SCRIPTS += threadsafety @@ -36,12 +36,12 @@ MOSTLYCLEANFILES = Test_parser_ERROR.asn check_PROGRAMS = Test_parser Test_tree Test_encoding Test_indefinite \ Test_errors Test_simple Test_overflow Test_strings Test_choice \ - Test_encdec copynode coding-decoding2 strict-der + Test_encdec copynode coding-decoding2 strict-der Test_choice_ocsp TESTS = Test_parser Test_tree Test_encoding Test_indefinite \ Test_errors Test_simple Test_overflow crlf threadsafety \ Test_strings Test_choice Test_encdec copynode coding-decoding2 \ - strict-der + strict-der Test_choice_ocsp TESTS_ENVIRONMENT = \ ASN1PARSER=$(srcdir)/Test_parser.asn \ diff --git a/tests/Test_choice.c b/tests/Test_choice.c index c00d738..9288ea3 100644 --- a/tests/Test_choice.c +++ b/tests/Test_choice.c @@ -34,7 +34,7 @@ main (int argc, char** argv) int data_size = sizeof (data); if (!choicefile) - choicefile = "choice.asn"; + choicefile = "pkix.asn"; /* Encode */ result = asn1_parser2tree (choicefile, &definitions, errorDescription); diff --git a/tests/ocsp.der b/tests/ocsp.der Binary files differnew file mode 100644 index 0000000..3134309 --- /dev/null +++ b/tests/ocsp.der diff --git a/tests/pkix.asn b/tests/pkix.asn index 579dd57..7ce8abe 100644 --- a/tests/pkix.asn +++ b/tests/pkix.asn @@ -1238,6 +1238,51 @@ id-on-xmppAddr OBJECT IDENTIFIER ::= { id-on 5 } XmppAddr ::= UTF8String +-- ocsp + +BasicOCSPResponse ::= SEQUENCE { + tbsResponseData ResponseData, + signatureAlgorithm AlgorithmIdentifier, + signature BIT STRING, + certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL } + +ResponseData ::= SEQUENCE { + version [0] EXPLICIT INTEGER DEFAULT 0, + responderID ResponderID, + producedAt GeneralizedTime, + responses SEQUENCE OF SingleResponse, + responseExtensions [1] EXPLICIT Extensions OPTIONAL } + +ResponderID ::= CHOICE { +-- Changed to work with the libtasn1 parser. + byName [1] EXPLICIT RDNSequence, --Name + byKey [2] OCTET STRING --SHA-1 hash of responder's public key +} + +CertID ::= SEQUENCE { + hashAlgorithm AlgorithmIdentifier, + issuerNameHash OCTET STRING, -- Hash of Issuer's DN + issuerKeyHash OCTET STRING, -- Hash of Issuers public key + serialNumber CertificateSerialNumber } + +CertStatus ::= CHOICE { + good [0] IMPLICIT NULL, + revoked [1] IMPLICIT RevokedInfo, + unknown [2] IMPLICIT UnknownInfo } + +SingleResponse ::= SEQUENCE { + certID CertID, + certStatus CertStatus, + thisUpdate GeneralizedTime, + nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL, + singleExtensions [1] EXPLICIT Extensions OPTIONAL } + +RevokedInfo ::= SEQUENCE { + revocationTime GeneralizedTime, + revocationReason [0] EXPLICIT CRLReason OPTIONAL } + +UnknownInfo ::= NULL -- this can be replaced with an enumeration + END -- Copyright (C) 2002-2014 Free Software Foundation, Inc. @@ -1256,3 +1301,4 @@ END -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. + |