1 /******************************************************************************* 2 3 D language bindings for libsodium's crypto_sign.h 4 5 License: ISC (see LICENSE.txt) 6 7 *******************************************************************************/ 8 9 module libsodium.crypto_sign; 10 11 @nogc nothrow: 12 13 import libsodium.export_; 14 import libsodium.crypto_sign_ed25519; 15 16 extern (C): 17 18 /* 19 * THREAD SAFETY: crypto_sign_keypair() is thread-safe, 20 * provided that sodium_init() was called before. 21 * 22 * Other functions, including crypto_sign_seed_keypair() are always thread-safe. 23 */ 24 25 alias crypto_sign_state = crypto_sign_ed25519ph_state; 26 27 size_t crypto_sign_statebytes (); 28 29 enum crypto_sign_BYTES = crypto_sign_ed25519_BYTES; 30 size_t crypto_sign_bytes (); 31 32 enum crypto_sign_SEEDBYTES = crypto_sign_ed25519_SEEDBYTES; 33 size_t crypto_sign_seedbytes (); 34 35 enum crypto_sign_PUBLICKEYBYTES = crypto_sign_ed25519_PUBLICKEYBYTES; 36 size_t crypto_sign_publickeybytes (); 37 38 enum crypto_sign_SECRETKEYBYTES = crypto_sign_ed25519_SECRETKEYBYTES; 39 size_t crypto_sign_secretkeybytes (); 40 41 enum crypto_sign_MESSAGEBYTES_MAX = crypto_sign_ed25519_MESSAGEBYTES_MAX; 42 size_t crypto_sign_messagebytes_max (); 43 44 enum crypto_sign_PRIMITIVE = "ed25519"; 45 const(char)* crypto_sign_primitive (); 46 47 int crypto_sign_seed_keypair (ubyte* pk, ubyte* sk, const(ubyte)* seed); 48 49 int crypto_sign_keypair (ubyte* pk, ubyte* sk); 50 51 int crypto_sign ( 52 ubyte* sm, 53 ulong* smlen_p, 54 const(ubyte)* m, 55 ulong mlen, 56 const(ubyte)* sk); 57 58 int crypto_sign_open ( 59 ubyte* m, 60 ulong* mlen_p, 61 const(ubyte)* sm, 62 ulong smlen, 63 const(ubyte)* pk); 64 65 int crypto_sign_detached ( 66 ubyte* sig, 67 ulong* siglen_p, 68 const(ubyte)* m, 69 ulong mlen, 70 const(ubyte)* sk); 71 72 int crypto_sign_verify_detached ( 73 const(ubyte)* sig, 74 const(ubyte)* m, 75 ulong mlen, 76 const(ubyte)* pk); 77 78 int crypto_sign_init (crypto_sign_state* state); 79 80 int crypto_sign_update (crypto_sign_state* state, const(ubyte)* m, ulong mlen); 81 82 int crypto_sign_final_create ( 83 crypto_sign_state* state, 84 ubyte* sig, 85 ulong* siglen_p, 86 const(ubyte)* sk); 87 88 int crypto_sign_final_verify ( 89 crypto_sign_state* state, 90 const(ubyte)* sig, 91 const(ubyte)* pk);