We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Almost got cffi working, just missing 1 little thing, I guess...
from cffi import FFI ffi = FFI() ffi.cdef(""" struct CpAbeCiphertext; struct CpAbeContext; struct CpAbeSecretKey; struct CpAbeContext* rabe_bsw_context_create(); void rabe_bsw_context_destroy(struct CpAbeContext* ctx); struct CpAbeSecretKey* rabe_bsw_keygen(const struct CpAbeContext* ctx, const char* attributes); void rabe_bsw_keygen_destroy(void* sk); int32_t rabe_bsw_encrypt(const void* pk, char* policy, char* pt, int32_t pt_len, char** ct, int32_t *ct_len); int32_t rabe_bsw_decrypt(const struct CpAbeSecretKey* sk, const char* ct, uint32_t ct_len, char** pt_buf, uint32_t *pt_len); """) C = ffi.dlopen("librabe.so") ctx = C.rabe_bsw_context_create() print(ctx) sk = C.rabe_bsw_keygen(ctx, b"[ \"test1\", \"test2\", \"test3\" ]") print(sk) pt = b"testing123" ct = ffi.new("char **") ct_len = ??? output = C.rabe_bsw_encrypt(ctx, b"{\"OR\": [{\"ATT\": \"A\"}, {\"ATT\": \"B\"}]}", pt, len(pt), ct, ct_len) print(output)
How should I define ct_len?
ct_len
The text was updated successfully, but these errors were encountered:
You don't. ct is allocated for you and ct_len will be set by the encrypt function https://github.com/Fraunhofer-AISEC/rabe/blob/master/src/ffi/bsw.rs#L117
Sorry, something went wrong.
No branches or pull requests
Almost got cffi working, just missing 1 little thing, I guess...
How should I define
ct_len
?The text was updated successfully, but these errors were encountered: