public static InputStream getDecryptingInputStream()

in src/java/org/apache/fulcrum/yaafi/framework/crypto/CryptoStreamFactory.java [53:73]


	public static InputStream getDecryptingInputStream(InputStream is, String isEncrypted) throws Exception {
		InputStream result;

		if (isEncrypted.equalsIgnoreCase("true")) {
			// a decrypting input stream was requested
			result = createDecryptingInputStream(is, "getInputStream");
		} else if (isEncrypted.equalsIgnoreCase("auto") && hasCryptoStreamFactory()) {
			// no user-supplied preferences but crypto stream is available
			result = createDecryptingInputStream(is, "getSmartInputStream");
		} else if (isEncrypted.equalsIgnoreCase("auto") && !hasCryptoStreamFactory()) {
			// no user-supplied perferences so we fall back to normal input stream
			result = is;
		} else if (isEncrypted.equalsIgnoreCase("false")) {
			// just use normal input stream
			result = is;
		} else {
			throw new IllegalArgumentException("Unknown decryption mode : " + isEncrypted);
		}

		return result;
	}