USB Authentication System

Hello all,

I’ve been working a program that allows queues to be synced across the network. As an extension to this program, I created an administrator mode that can be accessed by pressing a certain button combination (to remove entries/swap entries around, etc). This was not as secure as I wanted it to be, so I embarked on creating a USB authentication system, where the administrator would plug in a USB, the program would recognize that and enable administrator commands.

As of right now, I have created a fairly simple implementation of this system:

void checkAdminConnection() {
  List <File>files = Arrays.asList(File.listRoots());
  for (File f : files) {
    String s1 = FileSystemView.getFileSystemView().getSystemDisplayName(f);
    String type = FileSystemView.getFileSystemView().getSystemTypeDescription(f);
    if (s1.contains("Admin USB") && type.equals("USB Drive") && !adminCommands) {
      adminCommands = true;
      break;
    }
  }
}

All this system does is check the drive label and compare it to the administrator volume label. Ideally, this isn’t where I’d like to leave it at. I’d like to be able to have a hash file that’s unique to each USB drive, so that even if someone were to change a USB drive label to “Admin USB”, there’d still be one more layer of protection via the hash. I know I can get the total drive capacity through f.getTotalSpace() and use that, although I’d like to see if I can make the hash more secure by adding more factors to it. I’ve read about the USB4Java library, however I’d like to see if anyone has any other ideas. I know Java is a fairly high-level language, so I wouldn’t be surprised if USB4Java was my only option. But I figured it’s worth a shot.

With that said, would there be a way to create a hash using properties of a USB drive in Processing? Do I have any other options to create such a system? I’ve been looking into creating a similar system with an Arduino and serial communication, but I’d rather it be through USB.

Thanks in advance!