

現在Javaを使ってPDFファイルのパスワードを総当たりで解析するプログラムを作成しています。

半角英数字の組み合わせをn文字分出力するコードは出来たのですが、どのようにファイルのパスワードを自動入力させるかわかりません。

[code]

    import java.util.Scanner;
    
    class Analysis{
    
        static void recursive_increment(int digit,String[] ans,String[] str){
            if ( digit == 0 ){
                    for(int i = 0; i < ans.length;i++){
                        System.out.print(ans[i]);
                    }
                    System.out.print("\n");
            }else{
                for (int i = 0; i < 62 ;i++) {
                ans[digit-1] = str[i];
                recursive_increment(digit-1,ans,str);
                }
            }
        }
    
        public static void main(String args[]){
            Scanner scn = new Scanner(System.in);
            System.out.println("何桁の解析をしますか？");
            int num = scn.nextInt();
    
            String str[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r",
                                "s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K",
                                "L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
                                "1","2","3","4","5","6","7","8","9","0"};
            String ans[] = new String[num];
    
            int digit = num;
            recursive_increment(digit,ans,str);
        }
    }
    
[/code]


CC BY-SA 4.0
2020-06-02T13:07:14.850
67233
2020-06-02T16:31:26.447
2020-06-02T16:31:26.447
3060
39895
question
java pdf
PDFファイルのパスワードを自動入力するプログラム


> どのようにパスワードを自動入力させるかわかりません。

`iText` という PDF 作成、変換ライブラリを使って、PDF に パスワード設定したり  
パスワードを設定された PDF を パスワード無しのPDF に変換する事ができるようです。

<https://kb.itextpdf.com/home/it7kb/faq/how-to-decrypt-a-pdf-document-with-
the-owner-password>


CC BY-SA 4.0
2020-06-02T14:32:53.153
67236
2020-06-02T14:32:53.153
18851
67233
answer