8
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

暗号化の種類とbase64

Posted at

業務でセキュリティ高く実装する必要に迫られた。
その際に base64 で暗号化すれば十分かと思ったが、不適切と指摘されたので暗号化について調べてみた。

暗号化の種類

  1. keylessな暗号化
  2. private keyを使った暗号化
  3. pubilc keyを使った暗号化

keylessの暗号化

  • いわゆる暗号化処理のこと
  • base64もこれ
  • 一つの入力から、ランダムな文字列に置換する
  • 可逆なので、元の入力を復元することができる
  • 秘匿情報などを保持する際に使う

private keyを使った暗号化

  • 暗号対象の文と、秘密鍵の2つのインプットをもとにして一意なランダムな文字列を出力する

public keyを使った暗号化

  • 送り手と受け手がいることを想定
  • それぞれは public keyprivate keyを持つ
  • 相手には public keyを渡す。
  • 相手の public keyと自分の private keyから新しい keyを作成する。
  • この keyをもとに暗号化する

まとめ

base64で暗号化するだけだと、可逆な値なので良くないことがわかりました。
また、inputも暗号化対象の文だけなので、容易にもとの値を特定されてしまうんだなと。

参考

https://www.marineroad.com/staff-blog/17723.html
https://www.markupdancing.net/archive/20160310.html
https://paragonie.com/blog/2015/08/you-wouldnt-base64-a-password-cryptography-decoded

8
2
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?