Google Authenticator の秘密鍵を作成し、OTP を認証するアプリケーションを作成しようとしています。すべてのパスワードを、それらに付随する名前でタイトルが付けられた個々のファイルに書き込んでいます。
何よりもまず、私はこのライブラリを使用しています。 https://github.com/aerogear/aerogear-otp-java
これは私のコードです:
public void createUserFile(String name) throws IOException
{
File file = new File("users\\" + name + ".txt");
file.createNewFile();
}
public void generateUserKey(String name)
{
try
{
File file = new File("users\\" + name + ".txt");
FileWriter fw = new FileWriter(file);
BufferedWriter out = new BufferedWriter(fw);
String s = Base32.random();
out.write(s);
out.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
の値をs
「Hello」などに変更しても問題ありません。ただし、そのランダムな文字列は書き込まれません。それが私が助けを必要としているものです。何時間もかけて答えを探しましたが、何も見つかりませんでした。