Sealing.h 886 B

123456789101112131415161718192021222324252627
  1. //
  2. // Created by miti on 2019-12-21.
  3. //
  4. #ifndef DECRYPTORAPP_SEALING_H
  5. #define DECRYPTORAPP_SEALING_H
  6. #include "Decryptor_u.h"
  7. // for sealing - sgx_calc_sealed_data_size
  8. #include "sgx_tseal.h"
  9. // For reading from/writing to file -sealing.
  10. #include<unistd.h>
  11. #include <fcntl.h>
  12. #include <sys/types.h>
  13. #include <sys/stat.h>
  14. #include <errno.h>
  15. #include <stdio.h>
  16. class Sealing {
  17. uint32_t write_to_fd(int fd, uint8_t* msg, uint32_t* expected_msg_length);
  18. uint32_t read_from_fd(int fd, uint8_t* msg, uint32_t* expected_msg_length);
  19. uint32_t unseal_signing_key_pair_from_disk(sgx_enclave_id_t enclave_id, int fd, size_t sealed_msg_length_in_file);
  20. uint32_t create_and_seal_signing_key_pair_to_disk(sgx_enclave_id_t enclave_id, int fd);
  21. public:
  22. uint32_t initialize_long_term_keypair(sgx_enclave_id_t enclave_id, const char* filename);
  23. };
  24. #endif //DECRYPTORAPP_SEALING_H