ASF Bugzilla – Attachment 31195 Details for
Bug 35897
Password protected files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch for XOR encryption detection
xor-encryption-detection.patch (text/plain), 2.11 KB, created by
Trejkaz (pen name)
on 2014-01-10 06:06:24 UTC
(
hide
)
Description:
Proposed patch for XOR encryption detection
Filename:
MIME Type:
Creator:
Trejkaz (pen name)
Created:
2014-01-10 06:06:24 UTC
Size:
2.11 KB
patch
obsolete
>Index: dist/src/java/org/apache/poi/hssf/record/FilePassRecord.java >=================================================================== >--- dist/src/java/org/apache/poi/hssf/record/FilePassRecord.java (revision 32609) >+++ dist/src/java/org/apache/poi/hssf/record/FilePassRecord.java (working copy) >@@ -17,6 +17,7 @@ > > package org.apache.poi.hssf.record; > >+import org.apache.poi.EncryptedDocumentException; > import org.apache.poi.util.HexDump; > import org.apache.poi.util.LittleEndianOutput; > >@@ -49,7 +50,7 @@ > > switch (_encryptionType) { > case ENCRYPTION_XOR: >- throw new RecordFormatException("HSSF does not currently support XOR obfuscation"); >+ throw new EncryptedDocumentException("HSSF does not currently support XOR obfuscation"); > case ENCRYPTION_OTHER: > // handled below > break; >@@ -63,7 +64,7 @@ > break; > case ENCRYPTION_OTHER_CAPI_2: > case ENCRYPTION_OTHER_CAPI_3: >- throw new RecordFormatException( >+ throw new EncryptedDocumentException( > "HSSF does not currently support CryptoAPI encryption"); > default: > throw new RecordFormatException("Unknown encryption info " + _encryptionInfo); >Index: dist/src/java/org/apache/poi/hssf/record/RecordFactory.java >=================================================================== >--- dist/src/java/org/apache/poi/hssf/record/RecordFactory.java (revision 32609) >+++ dist/src/java/org/apache/poi/hssf/record/RecordFactory.java (working copy) >@@ -24,6 +24,7 @@ > import java.lang.reflect.Modifier; > import java.util.*; > >+import org.apache.poi.EncryptedDocumentException; > import org.apache.poi.hssf.record.chart.*; > import org.apache.poi.hssf.record.pivottable.*; > >@@ -62,6 +63,10 @@ > } catch (IllegalAccessException e) { > throw new RuntimeException(e); > } catch (InvocationTargetException e) { >+ // Unwrap "expected" exceptions. >+ if (e.getTargetException() instanceof EncryptedDocumentException) { >+ throw (EncryptedDocumentException) e.getTargetException(); >+ } > throw new RecordFormatException("Unable to construct record instance" , e.getTargetException()); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 35897
:
15796
|
15797
|
15798
|
27101
|
27102
|
31194
| 31195 |
31389
|
31398
|
31399
|
32208
|
32220
|
32258