1/*
2 * Copyright (c) 2006 Apple Computer, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of Apple nor the names of its contributors
14 *    may be used to endorse or promote products derived from this software
15 *    without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 */
29/*
30 * 6-July-2006
31 * DRI: Christopher Ryan <ryanc@apple.com>
32*/
33
34#ifndef _XAR_SIGNATURE_H_
35#define _XAR_SIGNATURE_H_
36
37#include "xar.h"
38
39struct __xar_x509cert_t{
40	uint8_t *content;
41	int32_t	len;
42	struct __xar_x509cert_t *next;
43};
44
45struct __xar_signature_t {
46	char *type;
47	int32_t	len;
48	off_t  offset;
49	int32_t x509cert_count;
50	struct __xar_x509cert_t *x509certs;
51	struct __xar_signature_t *next;
52	xar_signer_callback signer_callback;		/* callback for signing */
53	void	*callback_context;					/* context for callback */
54	xar_t x;
55#ifdef __APPLE__
56    int is_extended;
57#endif
58};
59
60#define XAR_SIGNATURE(x) ((struct __xar_signature_t *)(x))
61
62#ifdef __APPLE__
63xar_signature_t xar_signature_new_internal(xar_t x, int is_extended, const char *type, int32_t length, xar_signer_callback callback, void *callback_context);
64#endif
65
66int32_t xar_signature_serialize(xar_signature_t sig, xmlTextWriterPtr writer);
67xar_signature_t xar_signature_unserialize(xar_t x, xmlTextReaderPtr reader);
68
69
70/* deallocates the link list of xar signatures */
71void xar_signature_remove(xar_signature_t sig);
72
73#endif /* _XAR_SIGNATURE_H_ */
74