Here you can find the source of saveToFile(String fileName, BigInteger mod, BigInteger exp)
Parameter | Description |
---|---|
fileName | a parameter |
mod | Modulus |
exp | Exponent |
public static void saveToFile(String fileName, BigInteger mod, BigInteger exp)
//package com.java2s; //License from project: Open Source License import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.math.BigInteger; public class Main { /**//from w ww.j av a 2 s . c om * Save modulus and exponent of a key to file * * @param fileName * @param mod Modulus * @param exp Exponent */ public static void saveToFile(String fileName, BigInteger mod, BigInteger exp) { ObjectOutputStream oout = null; try { oout = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(fileName))); oout.writeObject(mod); oout.writeObject(exp); } catch (IOException e) { e.printStackTrace(); } finally { if (oout != null) { try { oout.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } }