Skip to content
导航栏

加密处理器调用错误

在 scripts js 脚本里面通过 Process 调用加密解密相关的处理器,为何会一直报 失败: Process:crypto.Hash format error 错误呢? let pwd = Process('crypto.Hash', 'SHA512', '123456')

这应该也是一个 bug。非白名单中的处理器名不能少于 3 个字段。

处理方法:

  • 使用 yao.crypto.Hash,而不是 crypto.Hash。
  • 使用 crypto.Hmac,而不是 crypto.Hmac
go
// yao-app-sources/gou/process.go
var whitelist = map[string]bool{
	"flows":     true,
	"session":   true,
	"ssl":       true,
	"websocket": true,
	"http":      true,
	"widget":    true,
}

func (process *Process) extraProcess() {

	namer := strings.Split(process.Name, ".")
	last := len(namer) - 1

//这里报错
	if _, has := whitelist[namer[0]]; last < 2 && !has {
		exception.New("Process:%s format error", 400, process.Name).Throw()
	}
}