Java's FileTypeDetector does not support the detection of the p7s file format out of the box. So, unless some of the file type detecting libraries out there do support the p7s format you are pretty much on your own.
The p7s extension is defined by the SMIME standard as the file extension used for PKCS-7 cryptographic signatures in RFC 2315. It's mime content type is actually application/pkcs7-signature
. Email clients that do not know how to handle these signatures allow the user to download them as a file.
The PKCS-7 syntax is described using ASN.1 in RFC 2315. The PKCS-7 signature is encoded using DER. Once you understand this, it is actually not that hard to verify if a p7s file is actually of the type pkcs7-signature.
In order to verify that p7s file is a pk7s-signature you can use an ASN.1 parser for Java like apache harmony to parse the file. Then you'll simply have to assert that the object identifier at the start of the ASN.1 sequence is of the type pkcs7-signedData
(see chapter 14 of RFC 2315 for a definition of this object identifier). This detection method does not proof that the p7s file actually is a PKCS-7 signature, but the chances are extremely high.
OpenSSL has a built in ASN1 parser. You can use it to manually apply the above described detection method:
$ openssl asn1parse -inform DER -in smime.p7s -dump -i
0:d=0 hl=4 l= 490 cons: SEQUENCE
4:d=1 hl=2 l= 9 prim: OBJECT :pkcs7-signedData
^^^^^^^^^^^^^^^^
that's what I am talking about
Hope this helps. Good luck!