Skip to content

Commit f2d7a4e

Browse files
committed
Replace itext6 with itext7 in comments, local variable names, etc.
1 parent ae5f7d8 commit f2d7a4e

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

core/src/main/java/com/itextpdf/core/pdf/PdfPublicKeySecurityHandler.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import com.itextpdf.basics.Utilities;
44

5+
import javax.crypto.Cipher;
6+
import javax.crypto.KeyGenerator;
7+
import javax.crypto.SecretKey;
58
import java.io.ByteArrayInputStream;
69
import java.io.ByteArrayOutputStream;
710
import java.io.IOException;
@@ -16,10 +19,6 @@
1619
import java.util.ArrayList;
1720
import java.util.List;
1821

19-
import javax.crypto.Cipher;
20-
import javax.crypto.KeyGenerator;
21-
import javax.crypto.SecretKey;
22-
2322
import org.bouncycastle.asn1.ASN1InputStream;
2423
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
2524
import org.bouncycastle.asn1.ASN1Primitive;
@@ -85,7 +84,7 @@ public byte[] getEncodedRecipient(int index) throws IOException, GeneralSecurity
8584
Certificate certificate = recipient.getCertificate();
8685
//constants permissions: PdfWriter.AllowCopy | PdfWriter.AllowPrinting | PdfWriter.AllowScreenReaders | PdfWriter.AllowAssembly;
8786
int permission = recipient.getPermission();
88-
// NOTE! Added while porting to itext6
87+
// NOTE! Added while porting to itext7
8988
// Previous strange code was:
9089
// int revision = 3;
9190
// permission |= revision == 3 ? 0xfffff0c0 : 0xffffffc0;
@@ -127,11 +126,11 @@ public PdfArray getEncodedRecipients() throws IOException, GeneralSecurityExcept
127126
EncodedRecipients.add(new PdfLiteral(Utilities.createEscapedString(cms)));
128127
} catch (GeneralSecurityException e) {
129128
EncodedRecipients = null;
130-
// break was added while porting to itext6
129+
// break was added while porting to itext7
131130
break;
132131
} catch (IOException e) {
133132
EncodedRecipients = null;
134-
// break was added while porting to itext6
133+
// break was added while porting to itext7
135134
break;
136135
}
137136
}

core/src/test/java/com/itextpdf/core/pdf/PdfEncryptionTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ public void encryptWithPassword(String filename, int encryptionType, int compres
116116
page.flush();
117117
document.close();
118118

119-
iText6Decrypt(filename, OWNER);
120-
//iText6Decrypt(filename, USER);
121-
iText6Decrypt(filename, OWNER, "(Hello world!)");
122-
//iText6Decrypt(filename, USER, "(Hello world!)");
119+
iText7Decrypt(filename, OWNER);
120+
//iText7Decrypt(filename, USER);
121+
iText7Decrypt(filename, OWNER, "(Hello world!)");
122+
//iText7Decrypt(filename, USER, "(Hello world!)");
123123
}
124124

125-
public void iText6Decrypt(String src, byte[] password, String pageContent) throws IOException {
125+
public void iText7Decrypt(String src, byte[] password, String pageContent) throws IOException {
126126
PdfReader reader = new com.itextpdf.core.pdf.PdfReader(src, password);
127127
PdfDocument document = new com.itextpdf.core.pdf.PdfDocument(reader);
128128
String author = document.getInfo().getAuthor();
@@ -136,7 +136,7 @@ public void iText6Decrypt(String src, byte[] password, String pageContent) throw
136136
document.close();
137137
}
138138

139-
public void iText6Decrypt(String src, byte[] password) throws IOException {
139+
public void iText7Decrypt(String src, byte[] password) throws IOException {
140140
PdfReader reader = new PdfReader(src, password);
141141
PdfDocument stamper = new PdfDocument(reader, new PdfWriter(new ByteArrayOutputStream()));
142142
stamper.close();

0 commit comments

Comments
 (0)