@Override protected void initializeFromScratch() { super.initializeFromScratch(); cosSetField(DK_Registry, COSString.create("Adobe")); cosSetField(DK_Ordering, COSString.create("Identity")); cosSetField(DK_Supplement, COSInteger.create(0)); }
public byte[] getDigestValue() { COSString cosDigestValue = cosGetField(DK_DigestValue).asString(); if (cosDigestValue == null) { return null; } return cosDigestValue.byteValue(); }
protected void do_endbfrange(CSOperation operation) { Iterator it = operation.getOperands(); while (it.hasNext()) { COSString start = (COSString) it.next(); COSString end = (COSString) it.next(); COSObject destination = (COSObject) it.next(); CMapRangeMap map; if (destination instanceof COSString) { byte[] destBytes = ((COSString) destination).byteValue(); if (destBytes.length > 2) { // this is special to /ToUnicode maps map = new CMapBFRangeStringMap( start.byteValue(), end.byteValue(), ((COSString) destination).byteValue()); } else { map = new CMapBFRangeCodeMap( start.byteValue(), end.byteValue(), ((COSString) destination).byteValue()); } } else { COSArray array = destination.asArray(); if (array.get(0) instanceof COSString) { // this is special to /ToUnicode maps map = new CMapBFRangeStringArrayMap( start.byteValue(), end.byteValue(), (COSArray) destination); } else { map = new CMapBFRangeNameArrayMap( start.byteValue(), end.byteValue(), (COSArray) destination); } } addMap(map); } }
protected byte[] getU() { COSString u = getEncryption().cosGetField(DK_U).asString(); if (u == null) { return null; } return u.byteValue(); }
protected byte[] getO() { COSString o = getEncryption().cosGetField(DK_O).asString(); if (o != null) { return o.byteValue(); } return null; }
protected void do_endnotdefchar(CSOperation operation) { Iterator it = operation.getOperands(); while (it.hasNext()) { COSString start = (COSString) it.next(); COSInteger destination = (COSInteger) it.next(); CMapCharMap map = new CMapCIDCharCodeMap(start.byteValue(), destination.intValue()); addNotdef(map); } }
protected void do_endcidrange(CSOperation operation) { Iterator it = operation.getOperands(); while (it.hasNext()) { COSString start = (COSString) it.next(); COSString end = (COSString) it.next(); COSInteger destination = (COSInteger) it.next(); CMapRangeMap map = new CMapCIDRangeCodeMap(start.byteValue(), end.byteValue(), destination.intValue()); addMap(map); } }
public void apply() throws COSSecurityException { // byte[] oPwd = createOwnerPassword(owner, user); COSString o = COSString.create(oPwd); getEncryption().cosSetField(StandardSecurityHandler.DK_O, o); byte[] uPwd = createUserPassword(user); COSString u = COSString.create(uPwd); getEncryption().cosSetField(StandardSecurityHandler.DK_U, u); // create new crypt key setCryptKey(createCryptKey(getUser())); }
protected void do_endcodespacerange(CSOperation operation) { Iterator it = operation.getOperands(); while (it.hasNext()) { COSString startString = (COSString) it.next(); if (!it.hasNext()) { break; } COSString endString = (COSString) it.next(); CMapRange range = new CMapRange(startString.byteValue(), endString.byteValue()); addRange(range); } }
protected byte[] getPermanentFileID() throws COSSecurityException { STDocument stDoc = stGetDoc(); if (stDoc == null) { throw new COSSecurityException("document missing"); } // force creation of file id if (stDoc.getTrailer().cosGetPermanentFileID() == null) { stDoc.getTrailer().updateFileID(); } COSString permanentId = stDoc.getTrailer().cosGetPermanentFileID(); if (permanentId != null) { return permanentId.byteValue(); } return null; }
public void setDigestValue(byte[] digest) { COSString cosDigestValue = null; if (digest != null) { cosDigestValue = COSString.create(digest); } cosSetField(DK_DigestValue, cosDigestValue); }
protected void do_endbfchar(CSOperation operation) { Iterator it = operation.getOperands(); while (it.hasNext()) { COSString start = (COSString) it.next(); COSObject destination = (COSObject) it.next(); CMapCharMap map; if (destination instanceof COSString) { byte[] destBytes = ((COSString) destination).byteValue(); if (destBytes.length > 2) { // this is special to /ToUnicode maps map = new CMapBFCharStringMap(start.byteValue(), destBytes); } else { map = new CMapBFCharCodeMap(start.byteValue(), destBytes); } } else { map = new CMapBFCharNameMap(start.byteValue(), (COSName) destination); } addMap(map); } }