private static SymmetricAlgorithm GetSymmetricAlgorithm(string algorithmType) { SymmetricAlgorithm sa = null; try { Type type = Type.GetType(algorithmType, true); sa = Activator.CreateInstance(type) as SymmetricAlgorithm; } catch (Exception ex) { // We want to supress any type of exception here for security reasons. CryptographyUtility.LogCryptographyException(ex); throw new CryptographicException(SR.ExceptionCreatingSymmetricAlgorithmInstance); } if (sa == null) { throw new CryptographicException(SR.ExceptionCastingSymmetricAlgorithmInstance); } return(sa); }