Passing sensitive data from C to Java
I am developing a C program which has to invoke a Java main() through
popen() and send some data as command line arguments to it. However, there
is some more data that needs to be sent to Java from C which is somewhat
sensitive in nature (not the password kinds, though).
I am trying to see if there is any other option besides encryption to send
this extra data from C to Java. I am trying to avoid overheads as data is
not as sensitive so as to go for encryption, but I am open to any
suggestion in this regard.
I cannot send this extra data through popen() as it will be visible
through "ps -f".
Similarly, using sockets does not seem viable because tcpdump can reveal
that information too.
I considered using shared mem (/dev/shm) but that too can be viewed or use
hidden files. Since, this also comes with overheads of creating files for
every invocation, I am not fully in favor.
I looked at ANON file mapping but I guess, I cannot use it in Java side.
Similarly, using fmemopen() reference does not seem be possible through
Java. Would FIFO pipes be a better option? Or can they also be read
easily?
If I just resort to plain mmap() and write data to it (not create it on
disk - no O_CREAT in open call), and not perform msynch would it remain
entirely in memory? Can I then read in Java from it?
Is encryption my only option or am I missing something basic?
This link discusses sending plain data over to Java from C.
No comments:
Post a Comment