diff --git a/cryp/box_rsa.cpp b/cryp/box_rsa.cpp
index c44bf9f..8438a0a 100644
--- a/cryp/box_rsa.cpp
+++ b/cryp/box_rsa.cpp
@@ -290,4 +290,10 @@ void CRSAOperator::free_hdata(HData& data)
     imp_->free_data(data);
 }
 
+void CRSAOperator::alloc_hdata(HData& data)
+{
+    assert(imp_);
+    imp_->alloc_data(data);
+}
+
 }   // namespace cppbox
\ No newline at end of file
diff --git a/cryp/box_rsa.h b/cryp/box_rsa.h
index 69f205a..5a8885f 100644
--- a/cryp/box_rsa.h
+++ b/cryp/box_rsa.h
@@ -27,6 +27,7 @@ public:
     bool        generate_keypair(const char* pub_path, const char* pri_path);
     bool        generate_keypair(HData& pub, HData& pri);
     void        free_hdata(HData& data);
+    void        alloc_hdata(HData& data);
     const char* get_last_error() const;
 };
 
diff --git a/test/cryp_test/main.cpp b/test/cryp_test/main.cpp
index f95fbee..56f9691 100644
--- a/test/cryp_test/main.cpp
+++ b/test/cryp_test/main.cpp
@@ -17,8 +17,8 @@ void file_test()
 
     HData source_data;
     int size = 512;
-    source_data.data = (unsigned char*)malloc(size);
     source_data.len = size;
+    opr.alloc_hdata(source_data);
     source_data.len = std::snprintf((char *)source_data.data, source_data.len, "This is a cryp test!");
 
     HData en_result_data;