jaehoon_kim 4 лет назад
Родитель
Сommit
49bd595c03
1 измененных файлов: 4 добавлений и 45 удалений
  1. 4
    45
      src/broker/modules/secure.go

+ 4
- 45
src/broker/modules/secure.go Просмотреть файл

11
 	KeyMap map[string]string
11
 	KeyMap map[string]string
12
 }
12
 }
13
 
13
 
14
+//Security 생성자
14
 func NewSecurity() *Security {
15
 func NewSecurity() *Security {
15
 	security := &Security{map[string]string{}}
16
 	security := &Security{map[string]string{}}
16
 	fmt.Println("security setting complete.")
17
 	fmt.Println("security setting complete.")
28
 	//CompareAlpha(topic1 []int64, topic2 []int64) int
29
 	//CompareAlpha(topic1 []int64, topic2 []int64) int
29
 }
30
 }
30
 
31
 
31
-/**
32
+/*
32
 keyShareMsg 에서 각 노드의 private 키를 받아 keyMap 에 저장
33
 keyShareMsg 에서 각 노드의 private 키를 받아 keyMap 에 저장
33
 */
34
 */
34
 func (sc Security) RegKey(rm RegisterMsg) {
35
 func (sc Security) RegKey(rm RegisterMsg) {
48
 	return mKey
49
 	return mKey
49
 }
50
 }
50
 
51
 
51
-/**
52
+/*
52
 reEncrypt 해서 슬라이스 반환
53
 reEncrypt 해서 슬라이스 반환
53
 */
54
 */
54
 func (sc Security) ReEncrypt(fromKey int64, toKey int64, target []int64) []int64 {
55
 func (sc Security) ReEncrypt(fromKey int64, toKey int64, target []int64) []int64 {
83
 	return toPubMsg
84
 	return toPubMsg
84
 }
85
 }
85
 
86
 
87
+//Key제거 함수
86
 func (sc *Security) RemoveSecureKey(nodeName string) bool {
88
 func (sc *Security) RemoveSecureKey(nodeName string) bool {
87
 	//삭제 전 존재여부 확인
89
 	//삭제 전 존재여부 확인
88
 	_, exists := sc.KeyMap[nodeName]
90
 	_, exists := sc.KeyMap[nodeName]
95
 		return false
97
 		return false
96
 	}
98
 	}
97
 }
99
 }
98
-
99
-/**
100
-Compare 함수들은 같으면 0 다르면 -1 (비교가 필요한 경우 오름차순 1 내림차순 -1)
101
-*/
102
-//func (sc Security) CompareTopic(topic1 []int64, topic2 []int64) int {
103
-//	// 길이 같은지 체크
104
-//	if len(topic1) != len(topic2) {
105
-//		return -1
106
-//	}
107
-//	for i := 0; i < len(topic2); i++ {
108
-//		if topic1[i] != topic2[i] {
109
-//			return -1
110
-//		}
111
-//	}
112
-//	return 0
113
-//}
114
-//
115
-//func (sc Security) CompareDigit(topic1 int64, topic2 int64) int {
116
-//	if topic1 < topic2 {
117
-//		return 1
118
-//	} else if topic1 > topic2 {
119
-//		return -1
120
-//	}
121
-//	return 0
122
-//}
123
-//
124
-//func (sc Security) CompareAlpha(topic1 []int64, topic2 []int64) int {
125
-//	// 길이 같은지 체크
126
-//	if len(topic1) != len(topic2) {
127
-//		return -1
128
-//	}
129
-//	for i := 0; i < len(topic2); i++ {
130
-//		if topic1[i] != topic2[i] {
131
-//			return -1
132
-//		}
133
-//	}
134
-//	return 0
135
-//}
136
-
137
-// private key 생성 메세지
138
-//func (sc Security) keyGenPrivate() KeyGenMsg{
139
-//
140
-//}

Загрузка…
Отмена
Сохранить