Here is what I modified:

def verify(data: File): Boolean = {
  val signedData = new CMSSignedData(new CMSProcessableFile(data), Base64.decode(this.value))
  val certStore = signedData.getCertificates.asInstanceOf[Store[X509CertificateHolder]]
  val signers = signedData.getSignerInfos.getSigners
  val signer =
  val certs = certStore.getMatches(signer.getSID.asInstanceOf[Selector[X509CertificateHolder]])
  val cert =
  signer.verify(new JcaSimpleSignerInfoVerifierBuilder().setProvider("BC").build(cert))

Now, the code compile without problem!

Thanks a lot.

Kind Regards,


If you look at, getCertificates returns a raw Store object instead of Store<Something>. Scala doesn't support working with raw types, generally speaking (they only exist in Java to interoperate with pre-Java-5 code). It's documented as

Return any X.509 certificate objects in this SignedData structure as a Store of X509CertificateHolder objects.

So you can try

val certStore = signedData.getCertificates.asInstanceOf[Store[X509CertificateHolder]]

and you'll also need casts in any other places where raw Store or Selector are returned.

Related Query

More Query from same tag