聚合国内IT技术精华文章,分享IT技术精华,帮助IT从业人士成长

Encrypt and decrypt a string in shell

2021-10-07 15:13 浏览: 171491 次 我要评论(0 条) 字号:

When using a container in Kubernetes, I prefer to use a shell command to complete the task instead of writing a python script since the shell commands are usually much simpler and intuitive.

If I want to encrypt a string “helloworld”, it could be accomplished by:

echo helloworld | openssl aes-256-cbc -a -salt -pbkdf2 -pass pass:mypassword

The ‘mypassword’ is the real password for encryption.

To decrypt, I could just use

echo U2FsdGVkX1+SWVzJK6Ji7DJ77r/U9XxyxNqDXrxZ6ck= | openssl aes-256-cbc -d -a -pbkdf2 -pass pass:mypassword



网友评论已有0条评论, 我也要评论

发表评论

*

* (保密)

Ctrl+Enter 快捷回复