-
Notifications
You must be signed in to change notification settings - Fork 22
/
get.go
79 lines (60 loc) · 1.36 KB
/
get.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package dh
import (
"github.com/deatil/go-cryptobin/dh/dh"
)
// 获取 PrivateKey
func (this DH) GetPrivateKey() *dh.PrivateKey {
return this.privateKey
}
// 获取 X 16进制字符
func (this DH) GetPrivateKeyXHexString() string {
if this.privateKey == nil {
return ""
}
data := this.privateKey.X.Text(16)
return data
}
// 获取 PublicKey
func (this DH) GetPublicKey() *dh.PublicKey {
return this.publicKey
}
// 获取 Y 16进制字符
func (this DH) GetPublicKeyYHexString() string {
if this.publicKey == nil {
return ""
}
data := this.publicKey.Y.Text(16)
return data
}
// 获取 P 16进制字符
func (this DH) GetPublicKeyParametersPHexString() string {
if this.publicKey == nil {
return ""
}
data := this.publicKey.Parameters.P.Text(16)
return data
}
// 获取 G 16进制字符
func (this DH) GetPublicKeyParametersGHexString() string {
if this.publicKey == nil {
return ""
}
data := this.publicKey.Parameters.G.Text(16)
return data
}
// 获取 keyData
func (this DH) GetKeyData() []byte {
return this.keyData
}
// 获取分组
func (this DH) GetGroup() *dh.Group {
return this.group
}
// 获取 secretData
func (this DH) GetSecretData() []byte {
return this.secretData
}
// 获取错误
func (this DH) GetErrors() []error {
return this.Errors
}