安全工具/RSA加密/解密
RSA加密/解密
使用RSA-OAEP进行公钥加密和解密
RSA密钥对
输入
输出
结果将显示在这里...RSA Encryption Guide
Learn about asymmetric encryption with RSA public-key cryptography
What is RSA?
RSA is an asymmetric encryption algorithm that uses a pair of keys: a public key for encryption and a private key for decryption. It's widely used for secure data transmission, digital signatures, and key exchange. RSA-OAEP (Optimal Asymmetric Encryption Padding) adds security against chosen-ciphertext attacks.
How to Use
- Click 'Generate Keys' to create a new RSA key pair
- Share your public key with others who need to send you encrypted messages
- Use the public key to encrypt messages
- Use your private key to decrypt messages encrypted with your public key
Security Best Practices
- Never share your private key with anyone
- Use RSA for encrypting small data or symmetric keys, not large files
- Store private keys securely, consider using a password manager
Security Note
Key generation and encryption happen entirely in your browser using the Web Crypto API. Private keys should be stored securely and never transmitted. For production use, consider using established cryptographic libraries.
常见问题
RSA和AES有什么区别?
RSA是非对称加密(公钥加密,私钥解密),适合密钥交换和数字签名。AES是对称加密(相同密钥加密解密),速度更快,适合大量数据。实际应用中常结合使用:RSA交换AES密钥,AES加密实际数据。
RSA密钥长度应该选多少?
目前推荐至少2048位,高安全需求建议4096位。512和1024位已不再安全。更长的密钥更安全但更慢。本工具生成2048位密钥,对大多数应用足够安全。量子计算时代可能需要更长密钥或切换到后量子算法。
公钥可以公开吗?
是的,公钥设计就是用来公开分享的。任何人都可以用公钥加密消息,但只有持有对应私钥的人才能解密。私钥必须严格保密,绝不能与他人分享。
RSA可以加密多大的数据?
RSA加密的数据大小受密钥长度限制。2048位密钥使用OAEP填充最多加密约214字节。加密大数据应使用混合加密:用RSA加密随机AES密钥,用AES加密实际数据。
什么是数字签名?
数字签名是用私钥对数据摘要进行加密,接收方用公钥验证。它证明:1) 数据确实来自私钥持有者(身份认证),2) 数据未被篡改(完整性)。用于代码签名、电子合同、TLS证书等场景。