Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlx 加密列 key长度校验 #102

Merged
merged 3 commits into from
Sep 30, 2022
Merged

sqlx 加密列 key长度校验 #102

merged 3 commits into from
Sep 30, 2022

Conversation

hookokoko
Copy link
Contributor

go中gcm加密算法中的仅支持16、24、32的key,在加密列工具中是否应该增加下对key的校验?将错误包装一下提示给用户

这是aes中的NewCipher方法

// NewCipher creates and returns a new cipher.Block.
// The key argument should be the AES key,
// either 16, 24, or 32 bytes to select
// AES-128, AES-192, or AES-256.
func NewCipher(key []byte) (cipher.Block, error) {
	k := len(key)
	switch k {
	default:
		return nil, KeySizeError(k)
	case 16, 24, 32:
		break
	}
	if boring.Enabled {
		return boring.NewAESCipher(key)
	}
	return newCipher(key)
}

@codecov
Copy link

codecov bot commented Sep 29, 2022

Codecov Report

Merging #102 (00471c7) into dev (926d442) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              dev     #102      +/-   ##
==========================================
+ Coverage   94.68%   94.70%   +0.01%     
==========================================
  Files          24       24              
  Lines        1148     1151       +3     
==========================================
+ Hits         1087     1090       +3     
  Misses         45       45              
  Partials       16       16              
Impacted Files Coverage Δ
sqlx/encrypt.go 73.07% <100.00%> (+0.79%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@flycash flycash merged commit f2d12ac into ecodeclub:dev Sep 30, 2022
flycash pushed a commit to flycash/ekit that referenced this pull request Nov 20, 2022
* sqlx 加密列 key长度校验

* sqlx 加密列 key长度校验 补单元测试

* 修改加密列key长度错误提示
flycash added a commit that referenced this pull request Dec 6, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
* sqlx 加密列 key长度校验 (#102)

* sqlx 加密列 key长度校验

* sqlx 加密列 key长度校验 补单元测试

* 修改加密列key长度错误提示

* atomicx: 泛型封装 atomic.Value (#101)

* atomicx: 泛型封装 atomic.Value

* 添加 CHANGELOG

* syncx/atomicx: 增加 Swap 和 CAS 的泛型包装

* 添加 swap nil 的测试

* 添加更加多的 benchmark 测试,同时保证 NewValue 和 NewValueOf 的语义在 nil 上一致

* 优化单元测试

* queue: API 定义 (#109)

* queue: API 定义

* 补充 API 说明

* 实现优先级队列和并发安全优先级队列 (#110)

基于小顶堆和切片的实现

* queue: 延时队列 (#115)

* 延迟队列: 优化唤醒入队元素逻辑 (#117)

* 修改CHANGELOG链接;添加测试用例修复bug

Signed-off-by: longyue0521 <longyueli0521@gmail.com>

* 修改cond的SignalCh为signalCh;理清注释

Signed-off-by: longyue0521 <longyueli0521@gmail.com>

Signed-off-by: longyue0521 <longyueli0521@gmail.com>

* value: AnyValue 设计 (#120) (#121)

* value: AnyValue 设计 (#120)

* 修复ci检测问题

* 1.fix cr问题
2.add changelog对该pr的引用
3.add license 头部

* 1.修改ChangeLog,加入新特性描述
2.挪出value包,放在根目录
3.统一error格式打印

* 断言方式.Name改为.String

Co-authored-by: vividwei <vividwei@tencent.com>

* queue: 基于切片的并发阻塞队列和基于 CAS 的并发队列设计 (#119)

* queue:使用list包中的LinkedList实现并发阻塞链式队列 (#122)

* queue:增加链式并发阻塞队列

Co-authored-by: kangdan <ujn_kangdan@qq.com>
Co-authored-by: dan.kang <dan.kang@realai.ai>

* ConcurrentLinkBlockingQueue 改成ConcurrentLinkedBlockingQueue (#123)



* ConcurrentLinkBlockingQueue 改成ConcurrentLinkedBlockingQueue

* modify .CHANGELOG.md

* modify .CHANGELOG.md

Co-authored-by: kangdan <ujn_kangdan@qq.com>
Co-authored-by: dan.kang <dan.kang@realai.ai>

* queue: ConcurrentLinkedQueue增加超时控制逻辑 (#124)



Co-authored-by: kangdan <ujn_kangdan@qq.com>
Co-authored-by: dan.kang <dan.kang@realai.ai>

* queue: 添加例子

- 添加队列例子
- 去除 ConcurrentLinkedQueue 的超时机制

* queue: 添加例子 (#126)

Signed-off-by: longyue0521 <longyueli0521@gmail.com>
Co-authored-by: hookokoko <648646891@qq.com>
Co-authored-by: Gevin <flyhigher139@gmail.com>
Co-authored-by: Longyue Li <longyueli0521@gmail.com>
Co-authored-by: 韦佳栋 <353470469@qq.com>
Co-authored-by: vividwei <vividwei@tencent.com>
Co-authored-by: kangdan666 <95063166+kangdan6@users.noreply.github.com>
Co-authored-by: kangdan <ujn_kangdan@qq.com>
Co-authored-by: dan.kang <dan.kang@realai.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants