- added payload CERT
- cleaned code of different states - added additional notify handling
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include <encoding/payloads/ke_payload.h>
|
||||
#include <encoding/payloads/notify_payload.h>
|
||||
#include <encoding/payloads/auth_payload.h>
|
||||
#include <encoding/payloads/cert_payload.h>
|
||||
#include <encoding/payloads/ts_payload.h>
|
||||
|
||||
|
||||
@@ -691,3 +692,43 @@ void test_parser_with_ts_payload(tester_t *tester)
|
||||
|
||||
ts_payload->destroy(ts_payload);
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in Header
|
||||
*/
|
||||
void test_parser_with_cert_payload(tester_t *tester)
|
||||
{
|
||||
parser_t *parser;
|
||||
cert_payload_t *cert_payload;
|
||||
status_t status;
|
||||
chunk_t cert_chunk, result;
|
||||
|
||||
u_int8_t cert_bytes[] = {
|
||||
0x00,0x00,0x00,0x11, /* payload header */
|
||||
0x03,
|
||||
0x04,0x05,0x06,0x07,/* 12 Byte nonce */
|
||||
0x08,0x09,0x0A,0x2B,
|
||||
0x0C,0x0D,0x0E,0x0F
|
||||
};
|
||||
|
||||
cert_chunk.ptr = cert_bytes;
|
||||
cert_chunk.len = sizeof(cert_bytes);
|
||||
|
||||
parser = parser_create(cert_chunk);
|
||||
tester->assert_true(tester,(parser != NULL), "parser create check");
|
||||
status = parser->parse_payload(parser, CERTIFICATE, (payload_t**)&cert_payload);
|
||||
tester->assert_true(tester,(status == SUCCESS),"parse_payload call check");
|
||||
parser->destroy(parser);
|
||||
|
||||
if (status != SUCCESS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
result = cert_payload->get_data_clone(cert_payload);
|
||||
tester->assert_true(tester,(cert_payload->get_cert_encoding(cert_payload) == DNS_SIGNED_KEY), "is DNS_SIGNED_KEY encoding");
|
||||
tester->assert_true(tester,(result.len == 12), "parsed data lenght");
|
||||
tester->assert_false(tester,(memcmp(cert_bytes + 5, result.ptr, result.len)), "parsed data");
|
||||
cert_payload->destroy(cert_payload);
|
||||
allocator_free_chunk(&result);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user