src/share/classes/org/openjdk/jigsaw/cli/Signer.java

Print this page

        

*** 414,444 **** // Compute the signature SignedModule.PKCS7Signer signer = new SignedModule.PKCS7Signer(); byte[] signature = signer.generateSignature(toBeSigned, params); // Generate the hash for the signature header and content baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); ! short signatureType = (short)signer.getSignatureType().value(); ! dos.writeShort(signatureType); ! short signatureLength = (short)signature.length; ! dos.writeInt(signature.length); ! byte[] signatureHeader = baos.toByteArray(); ! MessageDigest md = MessageDigest.getInstance("SHA-256"); ! md.update(signatureHeader); ! md.update(signature); ! byte[] hash = md.digest(); // Write out the Signature Section SectionHeader header = new SectionHeader(FileConstants.ModuleFile.SectionType.SIGNATURE, FileConstants.ModuleFile.Compressor.NONE, signature.length + 6, (short)0, hash); header.write(out); ! out.write(signatureHeader); ! out.write(signature); } } /** * Returns true if KeyStore has a password. This is true except for --- 414,439 ---- // Compute the signature SignedModule.PKCS7Signer signer = new SignedModule.PKCS7Signer(); byte[] signature = signer.generateSignature(toBeSigned, params); // Generate the hash for the signature header and content + SignatureSection signatureSection = + new SignatureSection(signer.getSignatureType().value(), + signature.length, signature); baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); ! signatureSection.write(dos); ! byte[] hash = MessageDigest.getInstance("SHA-256").digest(baos.toByteArray()); // Write out the Signature Section SectionHeader header = new SectionHeader(FileConstants.ModuleFile.SectionType.SIGNATURE, FileConstants.ModuleFile.Compressor.NONE, signature.length + 6, (short)0, hash); header.write(out); ! signatureSection.write(out); } } /** * Returns true if KeyStore has a password. This is true except for