system_utils.h 741 B

1234567891011121314151617181920212223242526
  1. #include <string>
  2. #include <vector>
  3. #ifndef PADDLE_MODEL_PROTECT_SYSTEM_UTIL_H
  4. #define PADDLE_MODEL_PROTECT_SYSTEM_UTIL_H
  5. namespace util {
  6. class SystemUtils {
  7. public:
  8. static std::string random_key_iv(int len);
  9. static std::string random_str(int len);
  10. static int check_key_match(const char* key, const char* filepath);
  11. static int check_key_match(const std::string &key, std::istream &cipher_stream);
  12. static int check_file_encrypted(const char* filepath);
  13. static int check_file_encrypted(std::istream &cipher_stream);
  14. static int check_pattern_exist(const std::vector<std::string>& vecs, const std::string& pattern);
  15. private:
  16. inline static int intN(int n);
  17. };
  18. }
  19. #endif //PADDLE_MODEL_PROTECT_SYSTEM_UTIL_H