source: examples/example_scripts/c/tchunk.c @ accd63d

mei_rt2
Last change on this file since accd63d was 97a6a36, checked in by Mei <mei@…>, 12 years ago

1) added java to libabac using swig
2) added java examples (setup/prover) into regression test suites
(note. still have that libstrongswan/src/threading/threads.c/thread_deinit()
problem when using using libabac with java)

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/**
2   tt.c
3
4**/
5
6#include <err.h>
7#include <stdio.h>
8#include <assert.h>
9
10#include <abac.h>
11
12extern void abac_print_cred_info(abac_credential_t*, FILE*);
13extern char *abac_id_keyid(abac_id_t *id);
14extern abac_attribute_t *abac_attribute_add_tail(abac_attribute_t *ptr, abac_aspect_t *);
15
16int main(int argc, char **argv) {
17    int i, success=0;
18    abac_credential_t *cred=NULL;
19    abac_credential_t **credentials=NULL;
20
21    abac_context_t *ctx = abac_context_new();
22
23    if(argc != 4) return 1;
24
25    /* build up structure */
26    abac_id_t *id =NULL;
27    id = abac_id_from_file(argv[2]);
28    int rc=abac_id_load_privkey_file(id,argv[3]);
29
30    int w=atoi(argv[1]);
31    if(w==0) {
32        printf("USING chunk...\n");
33        rc=abac_context_load_id_privkey_chunk(ctx, 
34                  abac_id_cert_chunk(id), 
35                  abac_id_privkey_chunk(id));
36    } else {
37        printf("USING NO chunk...\n");
38        rc=abac_context_load_id_id(ctx, id); 
39    }
40
41    show_yap_db("dump_yap");
42    abac_context_free(ctx);
43    return 0;
44}
Note: See TracBrowser for help on using the repository browser.