[HTML]View plain copy package utils; [HTML] View Plain copy import java.io.bytearrayoutputstream; import java.security.key; import java.security.keyfactory; import java.security.keypair; import java.security.keypairgenerator; import java.security.privatekey; Import java.security.PublicKey; import java.security.signature; import java.security.interfaces.rsaprivatekey; import java.security.interfaces.rsapublickey; import java.security.spec.pkcs8encodedkeyspec; import java.security.spec.x509encodedkeyspec; import java.util.hashmap; import java.util.map; import javax.crypto.cipher; /** * <p> * rsa Public/private key/signature Kit * </p> * <p> &NBsp;* Ronald Leevist (ron [r]ivest), Adi Samor (Adi [s]hamir) and Lennard Adman (Leonard [a]dleman) * </p> * <p> * The key in string format is BASE64 encoded format without special instructions <br/> * because the speed of asymmetric encryption is extremely slow, the general file does not use it to encrypt but uses symmetric encryption, <br/ > * Asymmetric Encryption algorithm can be used to encrypt the key encryption, so that the security of the key to ensure that the data security * </p> * * @author IceWee * @date 2012-4-26 * @version 1.0 */ public class rsautils { /** * Encryption algorithm rsa */ public static final string key_algorithm = "RSA"; /** * Signature Algorithm */ public static final string signature_algorithm = "Md5withrsa"; /** * getting the public key key */ private static final string public_key = "Rsapublickey";
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service