public void decryptString(COSString string, COSKey stringKey)
throws IOException, GeneralSecurityException {
byte[] stringBytes = getBytesOfHexString(string);
ASInputStream stream = new ASMemoryInStream(stringBytes);
ASInputStream filter;
if (isRC4Decryption) {
filter = new COSFilterRC4DecryptionDefault(stream, stringKey,
this.encryptionKey);
} else {
filter = new COSFilterAESDecryptionDefault(stream, stringKey,
this.encryptionKey, false, method);
}
byte[] buf = new byte[ASBufferedInFilter.BF_BUFFER_SIZE];
byte[] res = new byte[0];
int read = filter.read(buf, buf.length);
while (read != -1) {
res = ASBufferedInFilter.concatenate(res, res.length, buf, read);
read = filter.read(buf, buf.length);
}
filter.close();
string.set(res);
}