code: public StreamCodec buildStreamCryptoProvider(String algorithm, Map<String, Object> parameters) {
      switch (algorithm) {
        case EncryptionConfigParser.ENCRYPTION_TYPE_ANY:
        case "aes_rotating":
          CredentialStore cs = CredentialStoreFactory.buildCredentialStore(parameters);
          if (cs == null) {
            throw new IllegalArgumentException("Failed to build credential store; can't instantiate AES");
          }
  
          return new RotatingAESCodec(cs);
        case GPGCodec.TAG:
          String password = EncryptionConfigParser.getKeystorePassword(parameters);
          String keystorePathStr = EncryptionConfigParser.getKeystorePath(parameters);
          String keyName = EncryptionConfigParser.getKeyName(parameters);
          String cipherName = EncryptionConfigParser.getCipher(parameters);
  
          // if not using a keystore then use password based encryption
          if (keystorePathStr == null) {
            Preconditions.checkNotNull(password, "Must specify an en/decryption password for GPGCodec!");
            return new GPGCodec(password, cipherName);
          }
  
          // if a key name is not present then use a key id of 0. A GPGCodec may be configured without a key name
          // when used only for decryption where the key name is retrieved from the encrypted file
          return new GPGCodec(new Path(keystorePathStr), password,
              keyName == null ? 0 : Long.parseUnsignedLong(keyName, 16), cipherName);
        default:
          log.debug("Do not support encryption type {}", algorithm);
          return null;
      }
    }
docs: Return a StreamEncryptor for the given algorithm and with appropriate parameters.
  @param algorithm Algorithm to build
  @param parameters Parameters for algorithm
  @return A StreamEncoder for that algorithm
  @throws IllegalArgumentException If the given algorithm/parameter pair cannot be built