@@ -11,43 +11,43 @@ import (
1111)
1212
1313type (
14- // 配置
14+ // Options
1515 Opts = pkcs8.Opts
16- // PBKDF2 配置
16+ // PBKDF2 Options
1717 PBKDF2Opts = pkcs8.PBKDF2Opts
18- // Scrypt 配置
18+ // Scrypt Options
1919 ScryptOpts = pkcs8.ScryptOpts
2020)
2121
2222var (
23- // 获取 Cipher 类型
23+ // Get cipher from name
2424 GetCipherFromName = pkcs8 .GetCipherFromName
25- // 获取 hash 类型
25+ // Get hash from name
2626 GetHashFromName = pkcs8 .GetHashFromName
2727)
2828
29- // 生成私钥 pem 数据
29+ // Create PrivateKey PEM data
3030// dsa := New().GenerateKey("L2048N256")
3131// priKey := dsa.CreatePrivateKey().ToKeyString()
3232func (this DSA ) CreatePrivateKey () DSA {
3333 return this .CreatePKCS1PrivateKey ()
3434}
3535
36- // 生成私钥带密码 pem 数据
36+ // Create PrivateKey PEM data with password
3737// CreatePrivateKeyWithPassword("123", "AES256CBC")
3838// PEMCipher: DESCBC | DESEDE3CBC | AES128CBC | AES192CBC | AES256CBC
3939func (this DSA ) CreatePrivateKeyWithPassword (password string , opts ... string ) DSA {
4040 return this .CreatePKCS1PrivateKeyWithPassword (password , opts ... )
4141}
4242
43- // 生成公钥 pem 数据
43+ // Create PublicKey PEM data
4444func (this DSA ) CreatePublicKey () DSA {
4545 return this .CreatePKCS1PublicKey ()
4646}
4747
4848// ==========
4949
50- // 生成 pkcs1 私钥 pem 数据
50+ // Create PKCS1 PrivateKey PEM data
5151func (this DSA ) CreatePKCS1PrivateKey () DSA {
5252 if this .privateKey == nil {
5353 err := errors .New ("go-cryptobin/dsa: privateKey empty." )
@@ -69,7 +69,7 @@ func (this DSA) CreatePKCS1PrivateKey() DSA {
6969 return this
7070}
7171
72- // 生成 pkcs1 私钥带密码 pem 数据
72+ // Create PKCS1 PrivateKey PEM data with password
7373// CreatePKCS1PrivateKeyWithPassword("123", "AES256CBC")
7474// PEMCipher: DESCBC | DESEDE3CBC | AES128CBC | AES192CBC | AES256CBC
7575func (this DSA ) CreatePKCS1PrivateKeyWithPassword (password string , opts ... string ) DSA {
@@ -113,7 +113,7 @@ func (this DSA) CreatePKCS1PrivateKeyWithPassword(password string, opts ...strin
113113 return this
114114}
115115
116- // 生成 pkcs1 公钥 pem 数据
116+ // Create PKCS1 PublicKey PEM data
117117func (this DSA ) CreatePKCS1PublicKey () DSA {
118118 if this .publicKey == nil {
119119 err := errors .New ("go-cryptobin/dsa: publicKey empty." )
@@ -137,7 +137,7 @@ func (this DSA) CreatePKCS1PublicKey() DSA {
137137
138138// ==========
139139
140- // 生成 pkcs8 私钥 pem 数据
140+ // Create PKCS8 PrivateKey PEM data
141141func (this DSA ) CreatePKCS8PrivateKey () DSA {
142142 if this .privateKey == nil {
143143 err := errors .New ("go-cryptobin/dsa: privateKey empty." )
@@ -159,7 +159,7 @@ func (this DSA) CreatePKCS8PrivateKey() DSA {
159159 return this
160160}
161161
162- // 生成 PKCS8 私钥带密码 pem 数据
162+ // Create PKCS8 PrivateKey PEM data with password
163163// CreatePKCS8PrivateKeyWithPassword("123", "AES256CBC", "SHA256")
164164func (this DSA ) CreatePKCS8PrivateKeyWithPassword (password string , opts ... any ) DSA {
165165 if this .privateKey == nil {
@@ -195,7 +195,7 @@ func (this DSA) CreatePKCS8PrivateKeyWithPassword(password string, opts ...any)
195195 return this
196196}
197197
198- // 生成公钥 pem 数据
198+ // Create PKCS8 PublicKey PEM data
199199func (this DSA ) CreatePKCS8PublicKey () DSA {
200200 if this .publicKey == nil {
201201 err := errors .New ("go-cryptobin/dsa: publicKey empty." )
@@ -219,7 +219,7 @@ func (this DSA) CreatePKCS8PublicKey() DSA {
219219
220220// ====================
221221
222- // 生成私钥 xml 数据
222+ // Create PrivateKey XML data
223223func (this DSA ) CreateXMLPrivateKey () DSA {
224224 if this .privateKey == nil {
225225 err := errors .New ("go-cryptobin/dsa: privateKey empty." )
@@ -236,7 +236,7 @@ func (this DSA) CreateXMLPrivateKey() DSA {
236236 return this
237237}
238238
239- // 生成公钥 xml 数据
239+ // Create PublicKey XML data
240240func (this DSA ) CreateXMLPublicKey () DSA {
241241 if this .publicKey == nil {
242242 err := errors .New ("go-cryptobin/dsa: publicKey empty." )
0 commit comments