You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2020/09/17 18:05:14 UTC
svn commit: r1881799 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java
Author: tilman
Date: Thu Sep 17 18:05:14 2020
New Revision: 1881799
URL: http://svn.apache.org/viewvc?rev=1881799&view=rev
Log:
PDFBOX-4892: replace deprecated DEROutputStream
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java?rev=1881799&r1=1881798&r2=1881799&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java Thu Sep 17 18:05:14 2020
@@ -44,12 +44,12 @@ import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSString;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.bouncycastle.asn1.ASN1Encoding;
import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Set;
import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DEROutputStream;
import org.bouncycastle.asn1.DERSet;
import org.bouncycastle.asn1.cms.ContentInfo;
import org.bouncycastle.asn1.cms.EncryptedContentInfo;
@@ -477,17 +477,13 @@ public final class PublicKeySecurityHand
pkcs7input[21] = three;
pkcs7input[22] = two;
pkcs7input[23] = one;
-
+
ASN1Primitive obj = createDERForRecipient(pkcs7input, certificate);
-
ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- DEROutputStream k = new DEROutputStream(baos);
-
- k.writeObject(obj);
-
+ obj.encodeTo(baos, ASN1Encoding.DER);
+
recipientsField[i] = baos.toByteArray();
-
+
i++;
}
return recipientsField;