Tag: 签署

无法validation签名(cmssigneddata)bouncycastle

当我想validation我用BouncyCastle制作的签名时,我没有进入verifySignature方法的第二个while循环。 store.getMatches()返回一个空数组。 public static CMSSignedData sign() throws Exception { byte[] file = fileChooser(); store = KeyStore.getInstance(storeType); FileInputStream in = new FileInputStream(new File(storePathKey)); store.load(in, storePassword); in.close(); Key priv = store.getKey(“Subject”, storePassword); System.out.println(priv.toString() + “priv string”); X509Certificate cert = (X509Certificate) store.geCertificate(“Subject”); ContentSigner signer = new JcaContentSignerBuilder(sigAlgo).build((RSAPrivateKey) priv); CMSTypedData data = new CMSProcessableByteArray(file); CMSSignedDataGenerator gen = new CMSSignedDataGenerator(); […]