X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fmeshlink%2B%2B.h;h=a4829a4505204bb0c2f8b5a4494e1804cee36c45;hb=82a9712857c5b640288174493905499093853997;hp=02cd01a2d1ae26ad486340b028135689629c7cf9;hpb=c3e43398c1d6a31697ea70be30b40e936d4e4e9b;p=meshlink diff --git a/src/meshlink++.h b/src/meshlink++.h index 02cd01a2..a4829a45 100644 --- a/src/meshlink++.h +++ b/src/meshlink++.h @@ -168,12 +168,13 @@ namespace meshlink { * * @param data A pointer to a buffer containing the data to be signed. * @param len The length of the data to be signed. + * @param signature A pointer to a buffer where the signature will be stored. + * @param siglen The size of the signature buffer. Will be changed after the call to match the size of the signature itself. * - * @return This function returns a pointer to a string containing the signature, or NULL in case of an error. - * The application should call free() after it has finished using the signature. + * @return This function returns true if the signature is valid, false otherwise. */ - char *sign(const char *data, size_t len) { - return meshlink_sign(this, data, len); + bool sign(const void *data, size_t len, void *signature, size_t *siglen) { + return meshlink_sign(this, data, len, signature, siglen); } /// Verify the signature generated by another node of a piece of data. @@ -183,11 +184,12 @@ namespace meshlink { * @param data A pointer to a buffer containing the data to be verified. * @param len The length of the data to be verified. * @param signature A pointer to a string containing the signature. + * @param siglen The size of the signature. * * @return This function returns true if the signature is valid, false otherwise. */ - bool verify(node *source, const char *data, size_t len, const char *signature) { - return meshlink_verify(this, source, data, len, signature); + bool verify(node *source, const void *data, size_t len, const void *signature, size_t siglen) { + return meshlink_verify(this, source, data, len, signature, siglen); } /// Add an Address for the local node.