# 加密认证
# Flag
- 零知识证明(zero-knowledge proof)或零知识协议(zero-knowledge protocol) (opens new window)
- https://cryptoservices.github.io (opens new window)
- https://cromwell-intl.com (opens new window)
- 加密百科 https://github.com/logto-io/auth-wiki (opens new window)
# HTTP授权认证
- https://github.com/topics/authorization (opens new window)
- https://github.com/topics/ldap-authentication (opens new window)
- https://github.com/topics/identity-provider (opens new window)
- https://github.com/topics/mfa (opens new window)
- https://github.com/topics/cas (opens new window)
- https://github.com/topics/oauth (opens new window)
- https://github.com/topics/rbac (opens new window)
- WebAuthn无密码身份验证 https://github.com/w3c/webauthn (opens new window)
- FIDO(Fast Identity Online) https://github.com/fido-alliance (opens new window)
- https://github.com/duo-labs (opens new window)
- https://github.com/go-webauthn (opens new window)
- https://github.com/webauthn4j (opens new window)
- https://github.com/Yubico (opens new window)
- https://github.com/herrjemand/awesome-webauthn (opens new window)
- https://github.com/teamhanko/hanko (opens new window)
- https://github.com/passkeydeveloper/passkeys.dev (opens new window)
- https://github.com/MasterKale/SimpleWebAuthn (opens new window)
- https://github.com/fusionauth (opens new window)
- https://github.com/unkeyed/unkey (opens new window)
- https://github.com/goauthentik/authentik (opens new window)
- Web开发几种常用的认证机制 (opens new window)
- 角色访问控制模型RBAC96 (opens new window)
- 权限设计的杂谈 (opens new window)
- 详细了解RBAC(Role-Based Access Control) (opens new window)
Basic Auth:这种认证直接顺应HTTP协议的无状态性,每次执行业务的时候,将username与password参数发送给服务器进行验证
Session:是指在客户端Cookie中存储一个Session Id。请求时携带Session Id,服务器从Session数据存储中找到对应的Session。 Native App一般是不直接支持Cookie机制
- Radius
- AD(Active Directory) 域
- 什么是身份和访问管理 (IAM)? (opens new window)
- 身份访问与管理(IAM) (opens new window)
WebAuthn (Web Authentication)是Web标准的一部分,用于提供更安全的身份认证方法,可以使用生物识别数据、PIN码或移动设备来进行身份验证, 而不需要密码。其目的是减少密码相关的攻击,提高安全性。
CTAP (Client to Authenticator Protocol)协议, 主要用于在客户端设备(如计算机或移动设备)和身份验证器(例如生物识别设备、USB密钥等)之间建立通信, 并确保两者之间的通信安全,执行WebAuthn身份验证操作。
UAF (Universal Authentication Framework)规范,旨在提供更安全的身份验证方法,减少对传统密码的依赖。 允许使用生物识别信息、PIN码等进行身份验证。其目的是创建一个标准化的身份验证框架,适配不同的Web服务和应用。
U2F (Universal 2nd Factor)安全标准,旨在提供双重身份验证,即使用密码以外的第二个身份验证。 用户需要使用U2F设备(例如USB密钥)来进行身份验证。主要用于增强身份验证的安全性,而不是完全替代密码。
JWT是一种认证协议
JWT(Json web token)提供了一种用于发布接入令牌(Access Token),并对发布的签名接入令牌进行验证的方法。 令牌(Token)本身包含了一系列声明,应用程序可以根据这些声明限制用户对资源的访问。
应用场景:JWT是用在前后端分离, 需要简单的对后台API进行保护时使用.(前后端分离无session, 频繁传用户密码不安全)
# 编码算法
Escape Sequences
转义序列把数据转换成指定格式的数据,可解码,一般用于处理特殊字符
- Base32
- Base58
- Base64
- Base85
- Base91
- quoted-printable Percent-encoding (opens new window)
- Content-Transfer-Encoding (opens new window)
- Unicode编码(\u开头)
- URLEncoder(%开头)
- Gzip压缩
- UTF16编码(\x开头)
- Hexadecimal (Hex) 十六进制编码
- Octal 八进制
- Binary 二进制
- HTML entity
- ASCII
- Ascii85
- yEnc
Base64是一种能将任意Binary资料用64种字元组合成字串的方法,而Binary资料和字串资料彼此之间可以互相转换。 在实际应用中,Base64除了能将Binary资料可视化之外,也常用来表示字串加密过后的内容
# 加密算法
使用密钥加密数据转换成指定格式的数据,可通过密钥转换还原数据
- 同态加密(HE) https://github.com/homenc/HElib (opens new window)
- https://github.com/google/fully-homomorphic-encryption (opens new window)
- https://github.com/topics/eddsa (opens new window)
- https://github.com/topics/ed25519 (opens new window)
- https://github.com/topics/crypto-library (opens new window)
- 加密系统的ECRYPT基准测试 https://bench.cr.yp.to (opens new window)
- https://cr.yp.to (opens new window)
- https://github.com/noiseprotocol (opens new window)
- https://github.com/BLAKE3-team (opens new window)
- https://github.com/BLAKE2 (opens new window)
- https://github.com/syncsynchalt/illustrated-x25519 (opens new window)
- https://github.com/OpenPGP/openpgp.org (opens new window)
- 对称加密算法
- 分组加密算法
- DES(Data Encryption Standard)
- 2DES
- 3DES(Triple DES/DESede)
- AES (Advanced Encryption Standard)
- TwoFish
- Blowfish
- Camellia
- CAST5
- CAST6
- ChaCha
- GOST28147
- HC-128
- HC-256
- IDEA
- ISAAC
- Noekeon
- RC2
- RC4
- RC5-32
- RC5-64
- RC6
- Rijndael
- Salsa20
- SEED
- Serpent
- Skipjack
- TEA/XTEA
- Threefish
- Tnepres
- VMPC
- XSalsa20
- ARIA
- DES(Data Encryption Standard)
- 流式加密算法
- Salsa20
- ChaCha20
- ORYX
- SEAL
- Rabbit
- 分组加密算法
- 非对称加密算法 (opens new window)
- RSA
- RSA (with blinding) (opens new window)
- RSA2
- DSA(Digital Signature Algorithm)
- ECDSA
- ECC(Elliptic Curves Cryptography)
- DH
- ElGamal
- Rabin
- Merkle-Hellman(背包算法)
- Knapsack Algorithm
- NaccacheStern
- ECGOST3410
- ECNR
- GOST3410
- ISO9796d2
- PSS
- X9.31-1998
- 密钥交换算法
- DHE
- ECDHE
- Diffie-Hellman
- EC-DH
- EC-MQV
- J-PAKE
- SRP-6a
- PBE (Password Based Encryption) 口令加密算法
- PBEWithMD5AndDES
- PBEWithMD5AndTripeDES
- PBEWithSHA1AndDESede
- PBEWithSHA1AndRC2_40
- PBEWithMD5AndRC2
- PBEWithSHA1AndDES
- PBEWithSHA1AndRC2
- PBEWithSHAAndIDEA-CBC
- PBEWithSHAAnd2-KeyTripleDES-CBC
- PBEWithSHAAnd3-KeyTripleDES-CBC
- PBEWithSHAAnd128BitRC2-CBC
- PBEWithSHAAnd40BitRC2-CBC
- PBEWithSHAAnd128BitRC4
- PBEWithSHAAnd40BitRC4
- PBEWithSHAAndTwofish-CBC
- PBEwithMD2
- DES-CBC
- PBEwithMD2andRC2-CBC
- PBEwithMD5andDES-CBC
- PBEwithMD5andRC2-CBC
- PBEwithSHA1andDES-CBC
- PBEwithSHA1andRC2-CBC
- PBEwithSHA-1and128bitRC4
- PBEwithSHA-1and40bitRC4
- PBEwithSHA-1and3-keyDESEDE-CBC
- PBEwithSHA-1and2-keyDESEDE-CBC
- PBEwithSHA-1and128bitRC2-CBC
- PBEwithSHA-1and40bitRC2-CBC
- PBEwithHmacSHA-1
- PBEwithHmacSHA-224
- PBEwithHmacSHA-256
- PBEwithHmacRIPEMD128
- PBEwithHmacRIPEMD160
- PBEwithHmacRIPEMD256
- 签名算法
- MD2withRSA
- MD4withRSA
- MD5withRSA
- RIPEMD128withRSA
- RIPEMD160withECDSA
- RIPEMD160withRSA
- RIPEMD256withRSA
- SHA-1withRSA
- SHA-224withRSA
- SHA-256withRSAandMGF1
- SHA-384withRSAandMGF1
- SHA-512withRSAandMGF1
- SHA-1withDSA
- SHA-1withECDSA
- 轻量级加密算法
- Ascon (opens new window)https://github.com/SparkDustJoe/AsconManaged (opens new window)
- Ascon-128
- Ascon-XOF
- Ascon-Hash
- Ascon (opens new window)https://github.com/SparkDustJoe/AsconManaged (opens new window)
加密模式
- ECB(Electronic CodeBook mode):电子密码本模式
- CBC(Cipher Block Chaining mode):密码分组链模式
- CFB(Cipher FeedBack mode):密码反馈模式
- OFB(Output FeedBack mode):输出反馈模式
- CTR(CounTeR mode):计时器模式
- CTS
- GOFB
- OpenPGPCFB
- SIC (or CTR)
- CCM
- EAX
- GCM
- OCB
# 消息摘要
生成数据的唯一密文,不可逆
哈希 (Hash Algorithm) 散列算法,是将任意长度的数据映射为固定长度数据的算法,也称为消息摘要(主要用于数据完整性校验和加密/签名)。 一般情况下,哈希算法有两个特点:
原始数据的细微变化(比如一个位翻转)会导致结果产生巨大差距
运算过程不可逆,理论上无法从结果还原输入数据
- https://github.com/topics/encoder (opens new window)
- https://github.com/topics/decoder (opens new window)
- https://github.com/topics/encode (opens new window)
- https://github.com/topics/decode (opens new window)
- 密码哈希(Password Hash) (opens new window)
- https://en.wikipedia.org/wiki/SipHash (opens new window)
- https://github.com/gravity-postquantum (opens new window)
- https://sphincs.org (opens new window)
- https://github.com/P-H-C/phc-winner-argon2 (opens new window)
- https://www.bouncycastle.org (opens new window)
- https://github.com/Keyfactor (opens new window)
- MD
- MD2
- MD4
- MD5
- SHA
- SHA-0
- SHA-1
- SHA-2
- SHA-256
- SHA-384
- SHA-512
- SHA-3
- Keccak (opens new window)
- Keccak-256
- SHAKE128
- SHAKE256
- SHA3-224
- SHA3-256
- SHA3-384
- SHA3-512
- Keccak (opens new window)
- BLAKE (opens new window)
- BLAKE-224
- BLAKE-256
- BLAKE-384
- BLAKE-512
- Blake2 (opens new window)
- BLAKE2b
- BLAKE2bp
- BLAKE2s
- BLAKE2sp
- BLAKE2b
- BLAKE3 (opens new window)
- RipeMD(RACE原始完整性校验讯息摘要)
- RipeMD128
- RipeMD160
- RipeMD256
- RipeMD320Hex
- RipeMD320
- HmacRipeMD128
- HmacRipeMD160
- 密码哈希函数(Password Hash)
- PBKDF2
- Bcrypt
- Scrypt
- Argon2
- MAC
- CBCBlockCipher
- CFBBlockCipher
- CMAC
- GMAC
- GOST28147
- ISO9797 Alg. 3
- Poly1305
- SipHash
- SkeinMac
- VMPCMAC
- HMAC(Hash-based Message Authentication Code)散列消息认证码,结合一个加密密钥,通过特别计算方式之后产生的消息认证码(MAC)
- CRC 循环冗余校验(Cyclic Redundancy Check)
- CRC32
- CRC64
- Tiger
- HmacTiger
- Whirlpool
- Gost3411
应对普通哈希容易被破解的策略
- 加盐(salt)
加盐就是对目标字段哈希前,拼接上另一个字段(salt)。注:盐值加到字段之前较为普遍。加盐对防彩虹表很有效。
- 慢哈希
# 证书格式
.DER
/.CER
(X.509) 文件是二进制格式,只保存证书,不保存私钥,Java 和 Windows 服务器偏向于使用这种编码格式.PEM
(Privacy Enhanced Mail) 一般是文本格式,可保存证书,可保存私钥,常用于 Apache 和 Nginx 服务器- 一般为文本格式,以
-----BEGIN...
开头,以-----END...
结尾,中间的内容是 BASE64 编码。 - 这种格式可以保存证书和私钥,有时也把PEM 格式的私钥的后缀改为
.key
以区别证书与私钥
- 一般为文本格式,以
.CRT
(Certificate) 可以是二进制格式,可以是文本格式,与.DER
格式相同,不保存私钥。.PFX
/.P12
(Predecessor of PKCS#12) 二进制格式,同时包含证书和私钥,一般有密码保护。.JKS
(Java Key Storage) 二进制格式,同时包含证书和私钥,一般有密码保护,JAVA 专属格式,一般用于 Tomcat 服务器