main #24
@ -20,4 +20,4 @@ jobs:
|
||||
- name: Run script in Docker container
|
||||
run: |
|
||||
ls $PWD/src
|
||||
docker run -v .:/app git.mamahaha.work/sangge/tpre:base ls
|
||||
docker run --rm -v .:/app git.mamahaha.work/sangge/tpre:base ls
|
||||
|
53
FQA.md
Normal file
53
FQA.md
Normal file
@ -0,0 +1,53 @@
|
||||
# 答辩问题准备
|
||||
|
||||
1. **Q:数据安全与隐私**:您的系统在分布式环境中如何确保数据安全和隐私,尤其是在密钥管理方面的挑战?
|
||||
|
||||
**A:**
|
||||
|
||||
2. **Q:国家安全标准的遵循**:您能详细说明您的系统如何符合中国的国家安全标准,特别是对于政府和金融等敏感领域?
|
||||
|
||||
**A:**
|
||||
|
||||
3. **Q:系统架构**:您的分布式架构如何提高系统的性能和可伸缩性?
|
||||
|
||||
**A:**
|
||||
|
||||
4. **Q:算法效率**:您能讨论一下您系统中使用的门限代理重加密技术的效率和计算要求吗?
|
||||
|
||||
**A:**
|
||||
|
||||
5. **Q:兼容性与鲁棒性**:您的系统如何确保与各种环境(如区块链和分布式隐私计算)的兼容性,并且如何处理节点故障或恶意节点?
|
||||
|
||||
**A:**
|
||||
|
||||
6. **Q:实际应用场景**:您的系统在哪些实际场景中可以最有效地使用,这些场景中可能的局限性或挑战是什么?
|
||||
|
||||
**A:**
|
||||
|
||||
7. **Q:代码结构与模块化**:您的项目代码是如何组织的?您如何确保代码的模块化和可读性?
|
||||
|
||||
**A:**
|
||||
|
||||
8. **Q:算法实现**:在代码中,您如何实现门限代理重加密算法?有哪些关键的算法优化或创新点?
|
||||
|
||||
**A:**
|
||||
|
||||
9. **Q:性能测试**:您是否对代码进行了性能测试?测试结果显示的主要瓶颈和优化机会是什么?
|
||||
|
||||
**A:** 是的,我们使用了line_profiler这个工具进行性能测试。测试结果显示的主要瓶颈在于重加密密钥生成和解密这两个步骤。在这两个步骤中涉及到了椭圆曲线上的计算。我们使用了雅各比坐标系加快了计算速度。(雅各比坐标系通过减少在有限域中进行的昂贵的模逆运算,以及优化乘法操作的数量,使得椭圆曲线上的点加和点倍运算更加高效。这些优化对于加密和解密操作的速度至关重要,特别是在资源受限的环境)
|
||||
|
||||
10. **Q:安全性考虑**:在代码实现中,您如何处理潜在的安全漏洞,特别是与加密和数据传输相关的?
|
||||
|
||||
**A:**
|
||||
|
||||
11. **Q:错误处理和日志记录**:您的代码中是否包含了错误处理和日志记录机制?这些机制如何帮助监控和调试系统?
|
||||
|
||||
**A:** 我们使用了python内置的异常处理来处理错误。日志使用的是print函数来输出。
|
||||
|
||||
12. **Q:项目是如何应用在区块链中的:** 如题
|
||||
|
||||
**A:**
|
||||
|
||||
13. **Q:简单介绍一下代理重加密的数学原理:** 如题
|
||||
|
||||
**A:**
|
@ -210,7 +210,8 @@ def check_merge(ct: int, ip: str):
|
||||
temp_cfrag_cts = []
|
||||
for i in cfrag_cts:
|
||||
capsule = pickle.loads(i[0])
|
||||
temp_cfrag_cts.append((capsule, int(i[1]).to_bytes(32)))
|
||||
byte_length = (ct.bit_length() + 7) // 8
|
||||
temp_cfrag_cts.append((capsule, int(i[1]).to_bytes(byte_length)))
|
||||
|
||||
cfrags = mergecfrag(temp_cfrag_cts)
|
||||
|
||||
@ -368,10 +369,12 @@ async def receive_request(i_m: IP_Message):
|
||||
# message = xxxxx
|
||||
|
||||
# 根据message name到测试文本查找对应值
|
||||
message = test_msessgaes[i_m.message_name]
|
||||
try:
|
||||
message = test_msessgaes[i_m.message_name]
|
||||
|
||||
# message = b"hello world" + random.randbytes(8)
|
||||
print(f"Generated message: {message}")
|
||||
except:
|
||||
message = b"hello world" + random.randbytes(8)
|
||||
print(f"Message to be send: {message}")
|
||||
|
||||
# send message to nodes
|
||||
await send_messages(tuple(node_ips), message, dest_ip, pk_B, threshold)
|
||||
|
10
src/node.py
10
src/node.py
@ -32,7 +32,7 @@ processed_message = () # 重加密后的数据
|
||||
|
||||
# 向中心服务器发送自己的IP地址,并获取自己的id
|
||||
def send_ip():
|
||||
url = server_address + "/get_node?ip=" + ip
|
||||
url = server_address + "/get_node?ip=" + ip # type: ignore
|
||||
# ip = get_local_ip() # type: ignore
|
||||
global id
|
||||
id = requests.get(url, timeout=3)
|
||||
@ -52,7 +52,6 @@ def get_local_ip():
|
||||
s.close()
|
||||
except:
|
||||
raise ValueError("Unable to get IP")
|
||||
|
||||
|
||||
|
||||
def init():
|
||||
@ -72,7 +71,7 @@ def clear():
|
||||
async def send_heartbeat_internal() -> None:
|
||||
timeout = 30
|
||||
global ip
|
||||
url = server_address + "/heartbeat?ip=" + ip
|
||||
url = server_address + "/heartbeat?ip=" + ip # type: ignore
|
||||
while True:
|
||||
# print('successful send my_heart')
|
||||
try:
|
||||
@ -112,7 +111,10 @@ async def user_src(message: Req):
|
||||
dest_ip = message.dest_ip
|
||||
capsule = message.capsule
|
||||
ct = message.ct
|
||||
capsule_ct = (capsule, ct.to_bytes(32))
|
||||
|
||||
byte_length = (ct.bit_length() + 7) // 8
|
||||
capsule_ct = (capsule, ct.to_bytes(byte_length))
|
||||
|
||||
rk = message.rk
|
||||
print(f"Computed capsule_ct: {capsule_ct}")
|
||||
a, b = ReEncrypt(rk, capsule_ct)
|
||||
|
@ -11,7 +11,7 @@
|
||||
- [x] 测试不同消息长度的时间
|
||||
- 测试了10M文本的加密速度,在1s内可以完成全部算法内容
|
||||
|
||||
- [ ] 测试极限(1s)时的节点数
|
||||
- [x] 测试极限(1s)时的节点数
|
||||
- 12th Gen i5 CPU大概是90多个节点时达到1s的时间上限
|
||||
|
||||
- [x] 非docker部署需要获取本机ip
|
||||
|
Loading…
x
Reference in New Issue
Block a user