}
public char[] decryptPasswd(byte[] encryption, PrivateKey privateKey) throws ClipsServerException {
if (publicKey == null || privateKey == null) {
//md5 cannot to be decrypted
throw new ClipsServerException("Wrong usage of password encrypter");
}
try {
ObjectInputStream streamIn = new ObjectInputStream(
new ByteArrayInputStream(encryption, 0, encryption.length));
SealedObject encrypted = (SealedObject) streamIn.readObject();
Cipher dec = Cipher.getInstance("RSA");
dec.init(Cipher.DECRYPT_MODE, privateKey);
byte msg[] = (byte[]) encrypted.getObject(dec);
int passwdLength = msg.length - salt.length;
byte passwd[] = new byte[passwdLength];
System.arraycopy(msg, salt.length, passwd, 0, passwdLength);
return SessionPassword.byte2char(passwd);
} catch (Exception ex) {
throw new ClipsServerException("Ошибка при расшифровке RSA", ex);
}
}