How to run SignApk.class in android?

Following explains how to run SignApk.class run in android - Java SE to android

Add below attached android sun jarsign support JAR file - "android-sun-jarsign-support-1.1.jar" in android studio library libs folder and resync and use below code

I have also attached file in this topic for your reference

private static void writeSignatureBlock( Signature signature, X509Certificate publicKey, OutputStream out) throws IOException, GeneralSecurityException { SignerInfo signerInfo = new SignerInfo( new X500Name(publicKey.getIssuerX500Principal().getName()), publicKey.getSerialNumber(), AlgorithmId.get("SHA1"), AlgorithmId.get("RSA"), signature.sign()); PKCS7 pkcs7 = new PKCS7( new AlgorithmId[] { AlgorithmId.get("SHA1") }, new ContentInfo(ContentInfo.DATA_OID, null), new X509Certificate[] { publicKey }, new SignerInfo[] { signerInfo }); pkcs7.encodeSignedData(out); }
Sign In or Register to comment.