mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 16:44:23 +08:00
1 parent
4de22f9be7
commit
418a2fa0a7
4 files changed
+5
-14
No files matched your search
@@ -4463,8 +4463,7 @@ function updateEncryptionType() {
|
|||||||
el.encryptionCertificatesRow.hidden = !certificates;
|
el.encryptionCertificatesRow.hidden = !certificates;
|
||||||
el.encryptionPassword.required = el.encryptionConfirm.required = password;
|
el.encryptionPassword.required = el.encryptionConfirm.required = password;
|
||||||
el.encryptionCertificates.required = certificates;
|
el.encryptionCertificates.required = certificates;
|
||||||
const user = mode === "password" && encryptionMode() === mode ? state.doc.encryption.users?.[0] || "" : "";
|
el.encryptionUser.value = mode === "password" && encryptionMode() === mode ? state.doc.encryption.users?.[0] || "" : "";
|
||||||
el.encryptionUser.value = user === "User" ? "" : user;
|
|
||||||
el.encryptionPassword.value = el.encryptionConfirm.value = "";
|
el.encryptionPassword.value = el.encryptionConfirm.value = "";
|
||||||
el.encryptionCertificates.value = "";
|
el.encryptionCertificates.value = "";
|
||||||
el.encryptionStatus.textContent = mode === "keep" && state.doc?.encryption?.policyRequired ? "请重新选择加密方式" : "";
|
el.encryptionStatus.textContent = mode === "keep" && state.doc?.encryption?.policyRequired ? "请重新选择加密方式" : "";
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ type EncryptionRecipient struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// EncryptionOptions 设置GM/T0099加密,口令与证书方案二选一
|
// EncryptionOptions 设置GM/T0099加密,口令与证书方案二选一
|
||||||
// UserName标记口令接收者,不参与口令派生,留空使用User
|
// UserName标记口令接收者,不参与口令派生,留空不写入用户名
|
||||||
// 口令方案应使用足够长的随机口令;标准密钥派生不提供慢速口令哈希
|
// 口令方案应使用足够长的随机口令;标准密钥派生不提供慢速口令哈希
|
||||||
type EncryptionOptions struct {
|
type EncryptionOptions struct {
|
||||||
Password []byte
|
Password []byte
|
||||||
|
|||||||
@@ -40,11 +40,7 @@ func (e *Editor) SetEncryption(options *EncryptionOptions) error {
|
|||||||
}
|
}
|
||||||
info := EncryptionInfo{Encrypted: true, Method: "1.1.1", Layers: 1}
|
info := EncryptionInfo{Encrypted: true, Method: "1.1.1", Layers: 1}
|
||||||
if len(options.Password) != 0 {
|
if len(options.Password) != 0 {
|
||||||
name := options.UserName
|
info.Users = []string{options.UserName}
|
||||||
if name == "" {
|
|
||||||
name = "User"
|
|
||||||
}
|
|
||||||
info.Users = []string{name}
|
|
||||||
} else {
|
} else {
|
||||||
info.Method = "1.1.2"
|
info.Method = "1.1.2"
|
||||||
for _, recipient := range options.Recipients {
|
for _, recipient := range options.Recipients {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ type encryptionParams struct {
|
|||||||
|
|
||||||
// encryptionUser 保存单个接收者的公开信息及包装密钥
|
// encryptionUser 保存单个接收者的公开信息及包装密钥
|
||||||
type encryptionUser struct {
|
type encryptionUser struct {
|
||||||
Name string `xml:"UserName,attr"`
|
Name string `xml:"UserName,attr,omitempty"`
|
||||||
Role string `xml:"UserType,attr,omitempty"`
|
Role string `xml:"UserType,attr,omitempty"`
|
||||||
Certificate string `xml:"UserCert,omitempty"`
|
Certificate string `xml:"UserCert,omitempty"`
|
||||||
Key string `xml:"EncryptedWK"`
|
Key string `xml:"EncryptedWK"`
|
||||||
@@ -453,11 +453,7 @@ func encryptPackageParts(parts map[string][]byte, options EncryptionOptions, pro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
name := options.UserName
|
seed.Users = []encryptionUser{{Name: options.UserName, Role: options.UserType, Key: base64.StdEncoding.EncodeToString(wrapped), IV: base64.StdEncoding.EncodeToString(iv)}}
|
||||||
if name == "" {
|
|
||||||
name = "User"
|
|
||||||
}
|
|
||||||
seed.Users = []encryptionUser{{Name: name, Role: options.UserType, Key: base64.StdEncoding.EncodeToString(wrapped), IV: base64.StdEncoding.EncodeToString(iv)}}
|
|
||||||
} else {
|
} else {
|
||||||
seed.Method = "1.1.2"
|
seed.Method = "1.1.2"
|
||||||
for _, recipient := range options.Recipients {
|
for _, recipient := range options.Recipients {
|
||||||
|
|||||||
Reference in new issue
Block a user