Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSString


     * @throws IOException If there is an error accessing the data.
     */
    public byte[] getOwnerEncryptionKey() throws IOException
    {
        byte[] oe = null;
        COSString ownerEncryptionKey = (COSString)dictionary.getDictionaryObject( COSName.OE );
        if( ownerEncryptionKey != null )
        {
            oe = ownerEncryptionKey.getBytes();
        }
        return oe;
    }
View Full Code Here


     *
     * @throws IOException If there is an error setting the data.
     */
    public void setUserEncryptionKey(byte[] ue) throws IOException
    {
        COSString userEncryptionKey = new COSString();
        userEncryptionKey.append(ue);
        dictionary.setItem( COSName.UE, userEncryptionKey );
    }
View Full Code Here

     * @throws IOException If there is an error accessing the data.
     */
    public byte[] getUserEncryptionKey() throws IOException
    {
        byte[] ue = null;
        COSString userEncryptionKey = (COSString)dictionary.getDictionaryObject( COSName.UE );
        if( userEncryptionKey != null )
        {
            ue = userEncryptionKey.getBytes();
        }
        return ue;
    }
View Full Code Here

    public void setRecipients(byte[][] recipients) throws IOException
    {
        COSArray array = new COSArray();
        for (byte[] recipient : recipients)
        {
            COSString recip = new COSString();
            recip.append(recipient);
            recip.setForceLiteralForm(true);
            array.add(recip);
        }
        dictionary.setItem(COSName.RECIPIENTS, array);
    }
View Full Code Here

     *
     * @throws IOException If there is an error setting the data.
     */
    public void setPerms(byte[] perms) throws IOException
    {
        COSString user = new COSString();
        user.append( perms );
        dictionary.setItem( COSName.PERMS, user );
    }
View Full Code Here

     * @throws IOException If there is an error accessing the data.
     */
    public byte[] getPerms() throws IOException
    {
        byte[] perms = null;
        COSString cos_perms = (COSString)dictionary.getDictionaryObject( COSName.PERMS );
        if( cos_perms != null )
        {
            perms = cos_perms.getBytes();
        }
        return perms;
    }
View Full Code Here

            int recipientFieldsLength = 0;
            int i = 0;
            String extraInfo = "";
            for (; i < encryption.getRecipientsLength(); i++)
            {
                COSString recipientFieldString = encryption.getRecipientStringAt(i);
                byte[] recipientBytes = recipientFieldString.getBytes();
                CMSEnvelopedData data = new CMSEnvelopedData(recipientBytes);
                Iterator<?> recipCertificatesIt = data.getRecipientInfos().getRecipients().iterator();
                int j = 0;
                while (recipCertificatesIt.hasNext())
                {
View Full Code Here

            int sha1InputLength = seed.length;

            for(int j=0; j<dictionary.getRecipientsLength(); j++)
            {
                COSString string = dictionary.getRecipientStringAt(j);
                sha1InputLength += string.getBytes().length;
            }


            byte[] sha1Input = new byte[sha1InputLength];

            System.arraycopy(seed, 0, sha1Input, 0, 20);

            int sha1InputOffset = 20;


            for(int j=0; j<dictionary.getRecipientsLength(); j++)
            {
                COSString string = dictionary.getRecipientStringAt(j);
                System.arraycopy(
                    string.getBytes(), 0,
                    sha1Input, sha1InputOffset, string.getBytes().length);
                sha1InputOffset += string.getBytes().length;
            }

            MessageDigest sha1 = MessageDigests.getSHA1();
            byte[] mdResult = sha1.digest(sha1Input);
View Full Code Here

     */
    public PDDocumentCatalog( PDDocument doc )
    {
        document = doc;
        root = new COSDictionary();
        root.setItem( COSName.TYPE, new COSString( "Catalog" ) );
        document.getDocument().getTrailer().setItem( COSName.ROOT, root );
    }
View Full Code Here

                    {
                        md.update( values.next().toString().getBytes() );
                    }
                }
                idArray = new COSArray();
                COSString id = new COSString( md.digest() );
                idArray.add( id );
                idArray.add( id );
                trailer.setItem( "ID", idArray );
            }
            catch( NoSuchAlgorithmException e )
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.cos.COSString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.