You can use a library, or you can possibly invoke the gpg binary locally. I don't think this is specific to Spark or Scala.
You are correct it is not specific to Spark or scala. Do we have any process to invoke gpg binary or Jar library.
I tried below 2 cases.
GPG binary is installed on all nodes (Data nodes and Edge node).In this process I am able to decrypt local file (file on edge node) but when I try to decrypt HDFS file I got error as no file found.
I found a third party Jar file, which is working fine with Edge node file as Case 1. When I try to decrypt HDFS file, throws error file not found.