Author: ebourg-guest Date: 2013-07-15 22:13:32 +0000 (Mon, 15 Jul 2013) New Revision: 17036
Added: trunk/libitext-java/debian/patches/02_bouncycastle_compatibility.patch Removed: trunk/libitext-java/debian/patches/02_bouncycastle_1.47_port.patch Modified: trunk/libitext-java/debian/changelog trunk/libitext-java/debian/patches/series Log: Patched to compile against Bouncy Castle 1.49 Modified: trunk/libitext-java/debian/changelog =================================================================== --- trunk/libitext-java/debian/changelog 2013-07-15 22:12:06 UTC (rev 17035) +++ trunk/libitext-java/debian/changelog 2013-07-15 22:13:32 UTC (rev 17036) @@ -1,8 +1,9 @@ -libitext-java (2.1.7-7) UNRELEASED; urgency=low +libitext-java (2.1.7-7) unstable; urgency=low + * Patched to compile against Bouncy Castle 1.49 * Use canonical URLs for the Vcs-* fields - -- Emmanuel Bourg <[email protected]> Mon, 15 Jul 2013 23:43:09 +0200 + -- Emmanuel Bourg <[email protected]> Mon, 15 Jul 2013 23:57:34 +0200 libitext-java (2.1.7-6) unstable; urgency=low Deleted: trunk/libitext-java/debian/patches/02_bouncycastle_1.47_port.patch =================================================================== --- trunk/libitext-java/debian/patches/02_bouncycastle_1.47_port.patch 2013-07-15 22:12:06 UTC (rev 17035) +++ trunk/libitext-java/debian/patches/02_bouncycastle_1.47_port.patch 2013-07-15 22:13:32 UTC (rev 17036) @@ -1,206 +0,0 @@ -Description: Bouncy Castle 1.47 broke the binary compatibility with the previous - versions. iText 2.1.7 was developped for Bouncy Castle 1.38 and no longer works - with the recent versions. This patch addresses this issue and fixes the - compilation errors with Bouncy Castle 1.47 and later. - http://www.bouncycastle.org/wiki/display/JA1/Porting+from+earlier+BC+releases+to+1.47+and+later -Author: Emmanuel Bourg <[email protected]> -Origin: vendor -Forwarded: not-needed -Index: src/ant/.ant.properties -=================================================================== ---- src/ant/.ant.properties (revision 5738) -+++ src/ant/.ant.properties (working copy) -@@ -13,12 +13,12 @@ - jcommon.jar=${itext.lib}/jcommon.jar - servlet.jar=${itext.lib}/servlet.jar - --bc.jdk=jdk14 --bc.version=138 -+bc.jdk=jdk15on -+bc.version=1.48 - - lib.bcmail=bcmail-${bc.jdk}-${bc.version}.jar - lib.bcprov=bcprov-${bc.jdk}-${bc.version}.jar --lib.bctsp=bctsp-${bc.jdk}-${bc.version}.jar -+lib.bctsp=bcpkix-${bc.jdk}-${bc.version}.jar - lib.dom4j=pdf-renderer.jar - lib.pdf-renderer=dom4j-1.6.1.jar - -Index: src/core/com/lowagie/text/pdf/PdfPKCS7.java -=================================================================== ---- src/core/com/lowagie/text/pdf/PdfPKCS7.java (revision 5738) -+++ src/core/com/lowagie/text/pdf/PdfPKCS7.java (working copy) -@@ -77,21 +77,22 @@ - - import org.bouncycastle.asn1.ASN1Encodable; - import org.bouncycastle.asn1.ASN1EncodableVector; -+import org.bouncycastle.asn1.ASN1Encoding; - import org.bouncycastle.asn1.ASN1InputStream; - import org.bouncycastle.asn1.ASN1OutputStream; -+import org.bouncycastle.asn1.ASN1Primitive; - import org.bouncycastle.asn1.ASN1Sequence; - import org.bouncycastle.asn1.ASN1Set; -+import org.bouncycastle.asn1.ASN1String; - import org.bouncycastle.asn1.ASN1TaggedObject; - import org.bouncycastle.asn1.DEREnumerated; - import org.bouncycastle.asn1.DERInteger; - import org.bouncycastle.asn1.DERNull; --import org.bouncycastle.asn1.DERObject; - import org.bouncycastle.asn1.DERObjectIdentifier; - import org.bouncycastle.asn1.DEROctetString; - import org.bouncycastle.asn1.DEROutputStream; - import org.bouncycastle.asn1.DERSequence; - import org.bouncycastle.asn1.DERSet; --import org.bouncycastle.asn1.DERString; - import org.bouncycastle.asn1.DERTaggedObject; - import org.bouncycastle.asn1.DERUTCTime; - import org.bouncycastle.asn1.cms.AttributeTable; -@@ -379,7 +380,7 @@ - // - // Basic checks to make sure it's a PKCS#7 SignedData Object - // -- DERObject pkcs; -+ ASN1Primitive pkcs; - - try { - pkcs = din.readObject(); -@@ -464,7 +465,7 @@ - if (signerInfo.getObjectAt(next) instanceof ASN1TaggedObject) { - ASN1TaggedObject tagsig = (ASN1TaggedObject)signerInfo.getObjectAt(next); - ASN1Set sseq = ASN1Set.getInstance(tagsig, false); -- sigAttr = sseq.getEncoded(ASN1Encodable.DER); -+ sigAttr = sseq.getEncoded(ASN1Encoding.DER); - - for (int k = 0; k < sseq.size(); ++k) { - ASN1Sequence seq2 = (ASN1Sequence)sseq.getObjectAt(k); -@@ -949,7 +950,7 @@ - */ - public static String getOCSPURL(X509Certificate certificate) throws CertificateParsingException { - try { -- DERObject obj = getExtensionValue(certificate, X509Extensions.AuthorityInfoAccess.getId()); -+ ASN1Primitive obj = getExtensionValue(certificate, X509Extensions.AuthorityInfoAccess.getId()); - if (obj == null) { - return null; - } -@@ -961,7 +962,7 @@ - continue; - } else { - if ((AccessDescription.getObjectAt(0) instanceof DERObjectIdentifier) && ((DERObjectIdentifier)AccessDescription.getObjectAt(0)).getId().equals("1.3.6.1.5.5.7.48.1")) { -- String AccessLocation = getStringFromGeneralName((DERObject)AccessDescription.getObjectAt(1)); -+ String AccessLocation = getStringFromGeneralName((ASN1Primitive)AccessDescription.getObjectAt(1)); - if ( AccessLocation == null ) { - return "" ; - } else { -@@ -999,7 +1000,7 @@ - return false; - } - -- private static DERObject getExtensionValue(X509Certificate cert, String oid) throws IOException { -+ private static ASN1Primitive getExtensionValue(X509Certificate cert, String oid) throws IOException { - byte[] bytes = cert.getExtensionValue(oid); - if (bytes == null) { - return null; -@@ -1010,7 +1011,7 @@ - return aIn.readObject(); - } - -- private static String getStringFromGeneralName(DERObject names) throws IOException { -+ private static String getStringFromGeneralName(ASN1Primitive names) throws IOException { - DERTaggedObject taggedObject = (DERTaggedObject) names ; - return new String(ASN1OctetString.getInstance(taggedObject, false).getOctets(), "ISO-8859-1"); - } -@@ -1020,11 +1021,11 @@ - * @param enc a TBSCertificate in a byte array - * @return a DERObject - */ -- private static DERObject getIssuer(byte[] enc) { -+ private static ASN1Primitive getIssuer(byte[] enc) { - try { - ASN1InputStream in = new ASN1InputStream(new ByteArrayInputStream(enc)); - ASN1Sequence seq = (ASN1Sequence)in.readObject(); -- return (DERObject)seq.getObjectAt(seq.getObjectAt(0) instanceof DERTaggedObject ? 3 : 2); -+ return (ASN1Primitive)seq.getObjectAt(seq.getObjectAt(0) instanceof DERTaggedObject ? 3 : 2); - } - catch (IOException e) { - throw new ExceptionConverter(e); -@@ -1036,11 +1037,11 @@ - * @param enc A TBSCertificate in a byte array - * @return a DERObject - */ -- private static DERObject getSubject(byte[] enc) { -+ private static ASN1Primitive getSubject(byte[] enc) { - try { - ASN1InputStream in = new ASN1InputStream(new ByteArrayInputStream(enc)); - ASN1Sequence seq = (ASN1Sequence)in.readObject(); -- return (DERObject)seq.getObjectAt(seq.getObjectAt(0) instanceof DERTaggedObject ? 5 : 4); -+ return (ASN1Primitive)seq.getObjectAt(seq.getObjectAt(0) instanceof DERTaggedObject ? 5 : 4); - } - catch (IOException e) { - throw new ExceptionConverter(e); -@@ -1340,7 +1341,7 @@ - */ - public byte[] getAuthenticatedAttributeBytes(byte secondDigest[], Calendar signingTime, byte[] ocsp) { - try { -- return getAuthenticatedAttributeSet(secondDigest, signingTime, ocsp).getEncoded(ASN1Encodable.DER); -+ return getAuthenticatedAttributeSet(secondDigest, signingTime, ocsp).getEncoded(ASN1Encoding.DER); - } - catch (Exception e) { - throw new ExceptionConverter(e); -@@ -1575,7 +1576,7 @@ - vs = new ArrayList(); - values.put(id, vs); - } -- vs.add(((DERString)s.getObjectAt(1)).getString()); -+ vs.add(((ASN1String)s.getObjectAt(1)).getString()); - } - } - } -Index: src/core/com/lowagie/text/pdf/PdfPublicKeySecurityHandler.java -=================================================================== ---- src/core/com/lowagie/text/pdf/PdfPublicKeySecurityHandler.java (revision 5738) -+++ src/core/com/lowagie/text/pdf/PdfPublicKeySecurityHandler.java (working copy) -@@ -108,7 +108,7 @@ - import javax.crypto.SecretKey; - - import org.bouncycastle.asn1.ASN1InputStream; --import org.bouncycastle.asn1.DERObject; -+import org.bouncycastle.asn1.ASN1Primitive; - import org.bouncycastle.asn1.DERObjectIdentifier; - import org.bouncycastle.asn1.DEROctetString; - import org.bouncycastle.asn1.DEROutputStream; -@@ -244,7 +244,7 @@ - pkcs7input[22] = two; - pkcs7input[23] = one; - -- DERObject obj = createDERForRecipient(pkcs7input, (X509Certificate)certificate); -+ ASN1Primitive obj = createDERForRecipient(pkcs7input, (X509Certificate)certificate); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - -@@ -276,7 +276,7 @@ - return EncodedRecipients; - } - -- private DERObject createDERForRecipient(byte[] in, X509Certificate cert) -+ private ASN1Primitive createDERForRecipient(byte[] in, X509Certificate cert) - throws IOException, - GeneralSecurityException - { -@@ -287,7 +287,7 @@ - AlgorithmParameters algorithmparameters = algorithmparametergenerator.generateParameters(); - ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(algorithmparameters.getEncoded("ASN.1")); - ASN1InputStream asn1inputstream = new ASN1InputStream(bytearrayinputstream); -- DERObject derobject = asn1inputstream.readObject(); -+ ASN1Primitive derobject = asn1inputstream.readObject(); - KeyGenerator keygenerator = KeyGenerator.getInstance(s); - keygenerator.init(128); - SecretKey secretkey = keygenerator.generateKey(); -@@ -303,7 +303,7 @@ - EnvelopedData env = new EnvelopedData(null, derset, encryptedcontentinfo, null); - ContentInfo contentinfo = - new ContentInfo(PKCSObjectIdentifiers.envelopedData, env); -- return contentinfo.getDERObject(); -+ return contentinfo.toASN1Primitive(); - } - - private KeyTransRecipientInfo computeRecipientInfo(X509Certificate x509certificate, byte[] abyte0) Copied: trunk/libitext-java/debian/patches/02_bouncycastle_compatibility.patch (from rev 17033, trunk/libitext-java/debian/patches/02_bouncycastle_1.47_port.patch) =================================================================== --- trunk/libitext-java/debian/patches/02_bouncycastle_compatibility.patch (rev 0) +++ trunk/libitext-java/debian/patches/02_bouncycastle_compatibility.patch 2013-07-15 22:13:32 UTC (rev 17036) @@ -0,0 +1,185 @@ +Description: iText 2.1.7 was developped for Bouncy Castle 1.38 and no longer works + with the recent versions. This patch addresses this issue and fixes the + compilation errors with Bouncy Castle 1.47 and later. + http://www.bouncycastle.org/wiki/display/JA1/Porting+from+earlier+BC+releases+to+1.47+and+later +Author: Emmanuel Bourg <[email protected]> +Origin: vendor +Forwarded: not-needed +--- a/core/com/lowagie/text/pdf/PdfPKCS7.java ++++ b/core/com/lowagie/text/pdf/PdfPKCS7.java +@@ -77,21 +77,22 @@ + + import org.bouncycastle.asn1.ASN1Encodable; + import org.bouncycastle.asn1.ASN1EncodableVector; ++import org.bouncycastle.asn1.ASN1Encoding; + import org.bouncycastle.asn1.ASN1InputStream; + import org.bouncycastle.asn1.ASN1OutputStream; ++import org.bouncycastle.asn1.ASN1Primitive; + import org.bouncycastle.asn1.ASN1Sequence; + import org.bouncycastle.asn1.ASN1Set; ++import org.bouncycastle.asn1.ASN1String; + import org.bouncycastle.asn1.ASN1TaggedObject; + import org.bouncycastle.asn1.DEREnumerated; + import org.bouncycastle.asn1.DERInteger; + import org.bouncycastle.asn1.DERNull; +-import org.bouncycastle.asn1.DERObject; + import org.bouncycastle.asn1.DERObjectIdentifier; + import org.bouncycastle.asn1.DEROctetString; + import org.bouncycastle.asn1.DEROutputStream; + import org.bouncycastle.asn1.DERSequence; + import org.bouncycastle.asn1.DERSet; +-import org.bouncycastle.asn1.DERString; + import org.bouncycastle.asn1.DERTaggedObject; + import org.bouncycastle.asn1.DERUTCTime; + import org.bouncycastle.asn1.cms.AttributeTable; +@@ -379,7 +380,7 @@ + // + // Basic checks to make sure it's a PKCS#7 SignedData Object + // +- DERObject pkcs; ++ ASN1Primitive pkcs; + + try { + pkcs = din.readObject(); +@@ -464,7 +465,7 @@ + if (signerInfo.getObjectAt(next) instanceof ASN1TaggedObject) { + ASN1TaggedObject tagsig = (ASN1TaggedObject)signerInfo.getObjectAt(next); + ASN1Set sseq = ASN1Set.getInstance(tagsig, false); +- sigAttr = sseq.getEncoded(ASN1Encodable.DER); ++ sigAttr = sseq.getEncoded(ASN1Encoding.DER); + + for (int k = 0; k < sseq.size(); ++k) { + ASN1Sequence seq2 = (ASN1Sequence)sseq.getObjectAt(k); +@@ -949,7 +950,7 @@ + */ + public static String getOCSPURL(X509Certificate certificate) throws CertificateParsingException { + try { +- DERObject obj = getExtensionValue(certificate, X509Extensions.AuthorityInfoAccess.getId()); ++ ASN1Primitive obj = getExtensionValue(certificate, X509Extensions.AuthorityInfoAccess.getId()); + if (obj == null) { + return null; + } +@@ -961,7 +962,7 @@ + continue; + } else { + if ((AccessDescription.getObjectAt(0) instanceof DERObjectIdentifier) && ((DERObjectIdentifier)AccessDescription.getObjectAt(0)).getId().equals("1.3.6.1.5.5.7.48.1")) { +- String AccessLocation = getStringFromGeneralName((DERObject)AccessDescription.getObjectAt(1)); ++ String AccessLocation = getStringFromGeneralName((ASN1Primitive)AccessDescription.getObjectAt(1)); + if ( AccessLocation == null ) { + return "" ; + } else { +@@ -999,7 +1000,7 @@ + return false; + } + +- private static DERObject getExtensionValue(X509Certificate cert, String oid) throws IOException { ++ private static ASN1Primitive getExtensionValue(X509Certificate cert, String oid) throws IOException { + byte[] bytes = cert.getExtensionValue(oid); + if (bytes == null) { + return null; +@@ -1010,7 +1011,7 @@ + return aIn.readObject(); + } + +- private static String getStringFromGeneralName(DERObject names) throws IOException { ++ private static String getStringFromGeneralName(ASN1Primitive names) throws IOException { + DERTaggedObject taggedObject = (DERTaggedObject) names ; + return new String(ASN1OctetString.getInstance(taggedObject, false).getOctets(), "ISO-8859-1"); + } +@@ -1020,11 +1021,11 @@ + * @param enc a TBSCertificate in a byte array + * @return a DERObject + */ +- private static DERObject getIssuer(byte[] enc) { ++ private static ASN1Primitive getIssuer(byte[] enc) { + try { + ASN1InputStream in = new ASN1InputStream(new ByteArrayInputStream(enc)); + ASN1Sequence seq = (ASN1Sequence)in.readObject(); +- return (DERObject)seq.getObjectAt(seq.getObjectAt(0) instanceof DERTaggedObject ? 3 : 2); ++ return (ASN1Primitive)seq.getObjectAt(seq.getObjectAt(0) instanceof DERTaggedObject ? 3 : 2); + } + catch (IOException e) { + throw new ExceptionConverter(e); +@@ -1036,11 +1037,11 @@ + * @param enc A TBSCertificate in a byte array + * @return a DERObject + */ +- private static DERObject getSubject(byte[] enc) { ++ private static ASN1Primitive getSubject(byte[] enc) { + try { + ASN1InputStream in = new ASN1InputStream(new ByteArrayInputStream(enc)); + ASN1Sequence seq = (ASN1Sequence)in.readObject(); +- return (DERObject)seq.getObjectAt(seq.getObjectAt(0) instanceof DERTaggedObject ? 5 : 4); ++ return (ASN1Primitive)seq.getObjectAt(seq.getObjectAt(0) instanceof DERTaggedObject ? 5 : 4); + } + catch (IOException e) { + throw new ExceptionConverter(e); +@@ -1340,7 +1341,7 @@ + */ + public byte[] getAuthenticatedAttributeBytes(byte secondDigest[], Calendar signingTime, byte[] ocsp) { + try { +- return getAuthenticatedAttributeSet(secondDigest, signingTime, ocsp).getEncoded(ASN1Encodable.DER); ++ return getAuthenticatedAttributeSet(secondDigest, signingTime, ocsp).getEncoded(ASN1Encoding.DER); + } + catch (Exception e) { + throw new ExceptionConverter(e); +@@ -1575,7 +1576,7 @@ + vs = new ArrayList(); + values.put(id, vs); + } +- vs.add(((DERString)s.getObjectAt(1)).getString()); ++ vs.add(((ASN1String)s.getObjectAt(1)).getString()); + } + } + } +--- a/core/com/lowagie/text/pdf/PdfPublicKeySecurityHandler.java ++++ b/core/com/lowagie/text/pdf/PdfPublicKeySecurityHandler.java +@@ -108,7 +108,7 @@ + import javax.crypto.SecretKey; + + import org.bouncycastle.asn1.ASN1InputStream; +-import org.bouncycastle.asn1.DERObject; ++import org.bouncycastle.asn1.ASN1Primitive; + import org.bouncycastle.asn1.DERObjectIdentifier; + import org.bouncycastle.asn1.DEROctetString; + import org.bouncycastle.asn1.DEROutputStream; +@@ -244,7 +244,7 @@ + pkcs7input[22] = two; + pkcs7input[23] = one; + +- DERObject obj = createDERForRecipient(pkcs7input, (X509Certificate)certificate); ++ ASN1Primitive obj = createDERForRecipient(pkcs7input, (X509Certificate)certificate); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + +@@ -276,7 +276,7 @@ + return EncodedRecipients; + } + +- private DERObject createDERForRecipient(byte[] in, X509Certificate cert) ++ private ASN1Primitive createDERForRecipient(byte[] in, X509Certificate cert) + throws IOException, + GeneralSecurityException + { +@@ -287,7 +287,7 @@ + AlgorithmParameters algorithmparameters = algorithmparametergenerator.generateParameters(); + ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(algorithmparameters.getEncoded("ASN.1")); + ASN1InputStream asn1inputstream = new ASN1InputStream(bytearrayinputstream); +- DERObject derobject = asn1inputstream.readObject(); ++ ASN1Primitive derobject = asn1inputstream.readObject(); + KeyGenerator keygenerator = KeyGenerator.getInstance(s); + keygenerator.init(128); + SecretKey secretkey = keygenerator.generateKey(); +@@ -300,10 +300,10 @@ + AlgorithmIdentifier algorithmidentifier = new AlgorithmIdentifier(new DERObjectIdentifier(s), derobject); + EncryptedContentInfo encryptedcontentinfo = + new EncryptedContentInfo(PKCSObjectIdentifiers.data, algorithmidentifier, deroctetstring); +- EnvelopedData env = new EnvelopedData(null, derset, encryptedcontentinfo, null); ++ EnvelopedData env = new EnvelopedData(null, derset, encryptedcontentinfo, (org.bouncycastle.asn1.ASN1Set) null); + ContentInfo contentinfo = + new ContentInfo(PKCSObjectIdentifiers.envelopedData, env); +- return contentinfo.getDERObject(); ++ return contentinfo.toASN1Primitive(); + } + + private KeyTransRecipientInfo computeRecipientInfo(X509Certificate x509certificate, byte[] abyte0) Modified: trunk/libitext-java/debian/patches/series =================================================================== --- trunk/libitext-java/debian/patches/series 2013-07-15 22:12:06 UTC (rev 17035) +++ trunk/libitext-java/debian/patches/series 2013-07-15 22:13:32 UTC (rev 17036) @@ -1,2 +1,2 @@ 01_allow_standard_input.patch -02_bouncycastle_1.47_port.patch +02_bouncycastle_compatibility.patch _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

