2 * Copyright (c) 2009 The NetBSD Foundation, Inc.
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by Alistair Crooks (agc@NetBSD.org)
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 * BE 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.
30 * Copyright (c) 2005-2008 Nominet UK (www.nic.uk)
31 * All rights reserved.
32 * Contributors: Ben Laurie, Rachel Willmer. The Contributors have asserted
33 * their moral rights under the UK Copyright Design and Patents Act 1988 to
34 * be recorded as the authors of this copyright work.
36 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
37 * use this file except in compliance with the License.
39 * You may obtain a copy of the License at
40 * http://www.apache.org/licenses/LICENSE-2.0
42 * Unless required by applicable law or agreed to in writing, software
43 * distributed under the License is distributed on an "AS IS" BASIS,
44 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
46 * See the License for the specific language governing permissions and
47 * limitations under the License.
60 typedef struct __ops_create_sig_t __ops_create_sig_t
;
62 __ops_create_sig_t
*__ops_create_sig_new(void);
63 void __ops_create_sig_delete(__ops_create_sig_t
*);
65 unsigned __ops_check_useridcert_sig(const __ops_pubkey_t
*,
66 const __ops_userid_t
*,
68 const __ops_pubkey_t
*,
69 const unsigned char *);
70 unsigned __ops_check_userattrcert_sig(const __ops_pubkey_t
*,
71 const __ops_userattr_t
*,
73 const __ops_pubkey_t
*,
74 const unsigned char *);
75 unsigned __ops_check_subkey_sig(const __ops_pubkey_t
*,
76 const __ops_pubkey_t
*,
78 const __ops_pubkey_t
*,
79 const unsigned char *);
80 unsigned __ops_check_direct_sig(const __ops_pubkey_t
*,
82 const __ops_pubkey_t
*,
83 const unsigned char *);
84 unsigned __ops_check_hash_sig(__ops_hash_t
*,
86 const __ops_pubkey_t
*);
87 void __ops_sig_start_key_sig(__ops_create_sig_t
*,
88 const __ops_pubkey_t
*,
89 const __ops_userid_t
*,
91 void __ops_start_sig(__ops_create_sig_t
*,
92 const __ops_seckey_t
*,
93 const __ops_hash_alg_t
,
94 const __ops_sig_type_t
);
96 void __ops_sig_add_data(__ops_create_sig_t
*, const void *, size_t);
97 __ops_hash_t
*__ops_sig_get_hash(__ops_create_sig_t
*);
98 unsigned __ops_end_hashed_subpkts(__ops_create_sig_t
*);
99 unsigned __ops_write_sig(__ops_output_t
*, __ops_create_sig_t
*,
100 const __ops_pubkey_t
*, const __ops_seckey_t
*);
101 unsigned __ops_add_birthtime(__ops_create_sig_t
*, time_t);
102 unsigned __ops_add_issuer_keyid(__ops_create_sig_t
*,
103 const unsigned char *);
104 void __ops_add_primary_userid(__ops_create_sig_t
*, unsigned);
106 /* Standard Interface */
107 unsigned __ops_sign_file(__ops_io_t
*,
110 const __ops_seckey_t
*,
116 int __ops_sign_detached(__ops_io_t
*,
123 unsigned __ops_crc24(unsigned, unsigned char);
125 void __ops_reader_push_dearmour(__ops_stream_t
*);
127 void __ops_reader_pop_dearmour(__ops_stream_t
*);
128 unsigned __ops_writer_push_clearsigned(__ops_output_t
*, __ops_create_sig_t
*);
129 void __ops_writer_push_armor_msg(__ops_output_t
*);
133 OPS_PGP_PUBLIC_KEY_BLOCK
,
134 OPS_PGP_PRIVATE_KEY_BLOCK
,
135 OPS_PGP_MULTIPART_MESSAGE_PART_X_OF_Y
,
136 OPS_PGP_MULTIPART_MESSAGE_PART_X
,
138 } __ops_armor_type_t
;
140 #define CRC24_INIT 0xb704ceL
142 unsigned __ops_writer_use_armored_sig(__ops_output_t
*);
144 void __ops_writer_push_armoured(__ops_output_t
*, __ops_armor_type_t
);
146 __ops_memory_t
*__ops_sign_buf(__ops_io_t
*,
149 const __ops_seckey_t
*,
154 unsigned __ops_keyring_read_from_mem(__ops_io_t
*,
159 #endif /* SIGNATURE_H_ */