public byte[] DecryptText(EncryptTextMessage message) { byte[] decryptedText = null; //Odradi se enkripcija if (message.Algorithm == AlgorithmType.RC4) { RC4 rc = new RC4(message.Key, message.IV); decryptedText = rc.Decrypt(message.Data); } else if (message.Algorithm == AlgorithmType.RC4CTR) { RC4 rc = new RC4(message.Key, message.IV); decryptedText = rc.DecryptWithCTR(message.Data); } else if (message.Algorithm == AlgorithmType.A52 || message.Algorithm == AlgorithmType.A52CTR) { A52 alg = new A52(); alg.SetKey(message.Key); alg.SetF(message.FKeyA52); if (message.Algorithm == AlgorithmType.A52) { decryptedText = alg.Decrypt(message.Data); } else { alg.SetIV(message.IV); decryptedText = alg.DecryptWithCTR(message.Data); } } else if (message.Algorithm == AlgorithmType.RSA) { RSA rsa = new RSA(); rsa.E = new BigInteger(message.Key); rsa.P = new BigInteger(message.P); rsa.Q = new BigInteger(message.Q); rsa.GenerateRSA(); //BigInteger result = rsa.Decrypt(new BigInteger(message.Data)); //decryptedText = result.ToByteArray(); decryptedText = rsa.Decrypt(message.Data); } return(decryptedText); }