PageRenderTime 49ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/plugins/network_key/network_key.h

https://gitlab.com/m.schmidt/zuluCrypt
C Header | 83 lines | 41 code | 13 blank | 29 comment | 0 complexity | 0db81af8e56fcae4c89a04d30c8a6c37 MD5 | raw file
Possible License(s): BSD-3-Clause-No-Nuclear-License-2014, BSD-2-Clause
  1. /*
  2. * copyright: 2014-2015
  3. * name : Francis Banyikwa
  4. * email: mhogomchungu@gmail.com
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in
  14. * the documentation and/or other materials provided with the
  15. * distribution.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  18. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  20. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  21. * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
  23. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  24. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  25. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  27. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. * SUCH DAMAGE.
  29. */
  30. #include <stdio.h>
  31. #include <string.h>
  32. #include <stdlib.h>
  33. #include <unistd.h>
  34. #include "crypt_buffer.h"
  35. #include "../../zuluCrypt-cli/pluginManager/libzuluCryptPluginManager.h"
  36. #include "../../zuluCrypt-cli/utility/socket/socket.h"
  37. #include "../../zuluCrypt-gui/lxqt_wallet/backend/lxqtwallet.h"
  38. #define BUFFER_SIZE 1024
  39. struct zuluKey{
  40. u_int32_t wallet_key_length ;
  41. u_int32_t key_0_length ;
  42. u_int32_t key_1_length ;
  43. char key_0[ BUFFER_SIZE ] ;
  44. char key_1[ BUFFER_SIZE ] ;
  45. char wallet_key[ BUFFER_SIZE ] ;
  46. char wallet_name[ BUFFER_SIZE ] ;
  47. char application_name[ BUFFER_SIZE ] ;
  48. }__attribute__((__packed__)) ;
  49. typedef struct zuluKey zuluKey_t ;
  50. struct zuluValue{
  51. int key_found ;
  52. size_t value_length ;
  53. char value[ BUFFER_SIZE ] ;
  54. }__attribute__((__packed__)) ;
  55. typedef struct zuluValue zuluValue_t ;
  56. typedef struct{
  57. const char * path ;
  58. const char * uuid ;
  59. const char * wallet_key ;
  60. const char * encryption_key ;
  61. const char * network_address ;
  62. int port_number ;
  63. }arguments_t ;
  64. typedef struct{
  65. int got_key ;
  66. char key[ 1024 ] ;
  67. size_t key_len ;
  68. }result_t ;
  69. const char * NETWORK_ADDRESS = "127.0.0.1" ;
  70. int PORT_NUMBER = 40000 ;