现时想使用RSA+AES加密技术来进行加密解密求懂的大神来看看~

现在想使用RSA+AES加密技术来进行加密解密求懂的大神来看看~~~~
在网上找到一个范例:
先说下文字描述:
一,A先生成一个对称秘钥,这个秘钥可以是随机生成的,
二,A用B的公钥加密第一步生成的这个对称秘钥
三,A把加密过的对称秘钥发给B
四,A用第一步生成的这个对称秘钥加密实际要发的消息
五,A把用对称秘钥加密的消息发给B
对于B
他先收到A发来的对称秘钥,这个秘钥是用B的公钥加密过的,所以B需要用自己的私钥来解密这个秘钥
然后B又收到A发来的密文,这时候用刚才解密出来的秘钥来解密密文

代码:

public class RSA {

public static final int KEYSIZE = 512;

private KeyPair keyPair;
private Key publicKey;
private Key privateKey;

/**
 * 生成秘钥对
 * @return
 * @throws NoSuchAlgorithmException
 */
public KeyPair generateKeyPair() throws NoSuchAlgorithmException {
KeyPairGenerator pairgen = KeyPairGenerator.getInstance("RSA");
SecureRandom random = new SecureRandom();
pairgen.initialize(RSA.KEYSIZE, random);
this.keyPair = pairgen.generateKeyPair();
return this.keyPair;
}

/**
 * 加密秘钥
 * @param key
 * @return
 * @throws NoSuchAlgorithmException
 * @throws NoSuchPaddingException
 * @throws InvalidKeyException
 * @throws IllegalBlockSizeException
 */
public byte[] wrapKey(Key key) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.WRAP_MODE, this.privateKey);
byte[] wrappedKey = cipher.wrap(key);
return wrappedKey;
}

/**
 * 解密秘钥
 * @param wrapedKeyBytes
 * @return
 * @throws NoSuchAlgorithmException
 * @throws NoSuchPaddingException
 * @throws InvalidKeyException
 */
public Key unwrapKey(byte[] wrapedKeyBytes) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.UNWRAP_MODE, this.publicKey);
Key key = cipher.unwrap(wrapedKeyBytes, "AES", Cipher.SECRET_KEY);
return key;
}

public Key getPublicKey() {
return publicKey;
}

public void setPublicKey(Key publicKey) {
this.publicKey = publicKey;
}

public Key getPrivateKey() {
return privateKey;
}

public void setPrivateKey(Key privateKey) {