aboutsummaryrefslogtreecommitdiffstats
path: root/fop-core
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2016-07-06 08:27:51 +0000
committerSimon Steiner <ssteiner@apache.org>2016-07-06 08:27:51 +0000
commit02b005d2d3c7bc36801fb20831d3cdc9bab05dfc (patch)
tree8c0b3e90021f4c0b0fd53f0adfc06788734a3a52 /fop-core
parentdd20c66607917b37b8139f258d48ac26f8ec67f6 (diff)
downloadxmlgraphics-fop-02b005d2d3c7bc36801fb20831d3cdc9bab05dfc.tar.gz
xmlgraphics-fop-02b005d2d3c7bc36801fb20831d3cdc9bab05dfc.zip
FOP-916: URL in basic-link is scrambled by encryption
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1751621 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'fop-core')
-rw-r--r--fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java b/fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java
index a42b9c872..bc17dd997 100644
--- a/fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java
+++ b/fop-core/src/main/java/org/apache/fop/pdf/PDFUri.java
@@ -49,7 +49,7 @@ public class PDFUri extends PDFAction {
}
private String getDictString() {
- return "<< /URI (" + encodeString(uri) + ")\n/S /URI >>";
+ return "<< /URI " + encodeURI(uri) + "\n/S /URI >>";
}
/** {@inheritDoc} */
@@ -58,4 +58,13 @@ public class PDFUri extends PDFAction {
return getDictString();
}
+ private String encodeURI(String text) {
+ if (getDocument() != null && getDocumentSafely().isEncryptionActive()) {
+ final byte[] buf = PDFText.encode(text);
+ byte[] enc = getDocument().getEncryption().encrypt(buf, this);
+ return PDFText.toHex(enc, true);
+ } else {
+ return "(" + text + ")";
+ }
+ }
}