5 * Created by Michael Brouwer on 10/13/09.
6 * Copyright 2009 Apple Inc. All rights reserved.
10 #include <libDER/libDER.h>
13 #define FAST_SET_LOOKUP 1
15 #ifdef FAST_SET_LOOKUP
16 /* state representing a fast by tag set accessor, the caller needs to provide
17 a set large enough to hold all */
19 DERTag capacity
; /* should be large enough to hold all encountered tags.
20 otherwise DR_UnexpectedTag will be returned, note
21 that only one tag per tag number can exist. */
23 DERByte
*byTag
[]; /* maxTag element array of pointers to tag + length
24 of items in set indexed by tagNumber. */
27 /* Iterates over all the tags in the set to build an index returned in
29 DERReturn
DERDecodeSetContentInit(
30 const DERItem
*der
, /* data to decode */
31 DERSet
*derSet
); /* IN/OUT, to use in DERDecodeSetTag */
33 /* Returns DR_UnexpectedTag if the requested tag is not in derSet, returns
34 the content of the decoded item in content otherwise. */
35 DERReturn
DERDecodeSetTag(
36 DERSet
*derSeq
, /* data to decode */
37 DERTag tag
, /* tag in sequence/set we are looking for. */
38 DERItem
*content
); /* RETURNED */
39 #endif /* FAST_SET_LOOKUP */
42 DERReturn
DERSetDecodeItemWithTag(
43 const DERItem
*der
, /* data to decode */
44 DERTag tag
, /* tag in sequence/set we are looking for. */
45 DERItem
*content
); /* RETURNED */
48 /* Application Processor Ticket */
50 DERItem signatureAlgorithm
; /* AlgorithmId */
51 DERItem body
; /* SET OF OCTECT STRING, DER_DEC_SAVE_DER */
52 DERItem signature
; /* OCTET STRING */
53 DERItem certificates
; /* SEQUENCE of CERTIFICATE */
56 /* DERItemSpecs to decode into a DERApTicket */
57 extern const DERItemSpec DERApTicketItemSpecs
[];
58 extern const DERSize DERNumApTicketItemSpecs
;
60 DERReturn
DERDecodeApTicket(
61 const DERItem
*contents
,
62 DERApTicket
*ticket
, /* RETURNED */
63 DERSize
*numUsedBytes
); /* RETURNED */
68 DERItem signatureAlgorithm
; /* AlgorithmId */
69 DERItem body
; /* SET OF OCTECT STRING, DER_DEC_SAVE_DER */
70 DERItem signature
; /* OCTET STRING */
71 DERItem gpuk
; /* OCTET STRING */
74 /* DERItemSpecs to decode into a DERBbTicket */
75 extern const DERItemSpec DERBbTicketItemSpecs
[];
76 extern const DERSize DERNumBbTicketItemSpecs
;
78 DERReturn
DERDecodeBbTicket(
79 const DERItem
*contents
,
80 DERBbTicket
*ticket
, /* RETURNED */
81 DERSize
*numUsedBytes
); /* RETURNED */