Skip to content

Commit 3b88d2e

Browse files
authored
Update 12-cryptography.livemd
1 parent 70d22ac commit 3b88d2e

File tree

1 file changed

+61
-4
lines changed

1 file changed

+61
-4
lines changed

modules/12-cryptography.livemd

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,26 @@ Different types depending on
4040
-number of cycles
4141
-for complex algorithms etc..
4242

43+
symmetric encryption - secret key - one key used for encryption and decrption . Use this for performance/efficiency
44+
--application
45+
asymmetric encrytion - aka public-key cryptography - two keys, one for encrypting one for decrpyting, one shared (pubic) one kept secret(private)
46+
--application digital signatures
47+
4348
Old (Cracked - don't use)
44-
DES,etc.
4549

4650
Newer (Resilient/proven secure by industry)
47-
AES
51+
AES - symmetric; CBC and GCM modes most secure
4852

53+
Diffie-Hellman key exchange
54+
RSA
4955

56+
TLS cipher suites
5057

58+
[symmetric cryptography](https://developer.mozilla.org/en-US/docs/Glossary/Symmetric-key_cryptography)
59+
[NIST](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-77r1.pdf)
5160
### <span style="color:blue;">Example</span> / <span style="color:red;">Quiz</span>
5261

62+
5363
*TODO: Make Example or Quiz Question*
5464

5565
```elixir
@@ -68,10 +78,26 @@ Algorithms above
6878

6979
Best practices for secure algorithms
7080

81+
Use those recommended by NIST -
82+
Progamming language frameworks have built in libraries.
83+
84+
For elixir, ExCrypto module[ExCrypto](https://hexdocs.pm/ex_crypto/ExCrypto.html)
85+
86+
Consider what needs to be encrypted - sensitive data or any other data that
87+
Data classification, regulatory implications that must be protected from unauthorized access/seeing
88+
89+
Confidentiality
90+
91+
For in-transit
92+
use HTTPS which implements encrpytion over a channel. Diffie-Hellman
93+
[Serving over HTTPS
94+
](https://hexdocs.pm/plug/https.html)
7195

7296
### <span style="color:blue;">Example</span> / <span style="color:red;">Quiz</span>
7397

7498
*TODO: Make Example or Quiz Question*
99+
[
100+
](https://hexdocs.pm/plug/https.html)
75101

76102
```elixir
77103

@@ -81,11 +107,20 @@ Best practices for secure algorithms
81107

82108
### Description
83109

84-
Hash - Sometimes implemented alongside encryption but has a different purpose
110+
Hash - Sometimes implemented alongside encryption but has a different purpose;
111+
Cryptography used for confidentiality; keeping information secret except for intended receipient/audience. Hashes are used to ensure the
112+
integrity of the data, meaning ensuring from it's creation/generation to it's final state, it remains unmodified and untampered with.
113+
Hashes also used as a substitute for storing data in it's original form. A one way function that - compare starting hash from known good data, to end hash which will indicate changes. Hashing passwords is a common application. Comparing hashes to determine if correct password entered.
114+
Hash Algorithms - SHA1, SHA2, MD5 (obsolete) - follow recommendations from
115+
116+
NIST [Approved Hash Algorithms](https://csrc.nist.gov/Projects/Hash-Functions)
117+
85118
Digital Certificates - Application of cryptography/private keys
86-
Encoding - Can be confused because it is also a way to represent data that looks different from it's plaintext start
87119

88120

121+
NIST
122+
[Erlang crypto module](https://elixir-lang.org/getting-started/erlang-libraries.html#the-crypto-module)
123+
89124
### <span style="color:blue;">Example</span> / <span style="color:red;">Quiz</span>
90125

91126
*TODO: Make Example or Quiz Question*
@@ -104,6 +139,28 @@ Recommendations
104139
-Recommended algorithms
105140
-Sources for publishing notices when algorithms become cracked/obsolete and new
106141

142+
Cryptographic Failures are the number two most common issue on the OWASP Top 10
143+
A02:2021 – Cryptographic Failures
144+
145+
Related weaknesses include
146+
Notable Common Weakness Enumerations (CWEs) include CWE-327: Broken or Risky Crypto Algorithm, and CWE-331 Insufficient Entropy.
147+
148+
All amount to data being inadvertently being sent in cleartext, sensitive data, the use of old, weak or custom cryptographic algorithms or protocols that are ineffective against attacker efforts to uncover keys, . Best practics is to never build your own crypto mechanisms. Use proven and secure:
149+
Secure Hashes: SHA-1 has been deprecated as of 2011 with a transition plan released in 2022. Recommenation to move towards orther families SHA256
150+
Secure Encryption Algorithms; AES is the current standard; secure modes must be emplemented
151+
AES-GCM, AES-CTR, AES-CBC, AESCCM (128, 192, 256-bit keys)
152+
For authentication/TLS RSA, DSA, and ECDSA with 128-bit
153+
security strength (for example, RSA with
154+
3072-bit or larger key)
155+
156+
[
157+
](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-77r1.pdf)[
158+
NIST](https://www.nist.gov/cryptography)
159+
[Encryption Standard](https://csrc.nist.gov/Projects/block-cipher-techniques)
160+
https://csrc.nist.gov/Projects/Hash-Functions
161+
[Elixir encryption, hashing, etc. Modules](https://elixir-lang.org/getting-started/erlang-libraries.html#the-crypto-module)
162+
[OWASP Top10](https://owasp.org/Top10/A02_2021-Cryptographic_Failures/)
163+
[Use TLS](https://cheatsheetseries.owasp.org/cheatsheets/Transport_Layer_Protection_Cheat_Sheet.html)
107164
### <span style="color:blue;">Example</span> / <span style="color:red;">Quiz</span>
108165

109166
*TODO: Make Example or Quiz Question*

0 commit comments

Comments
 (0)