Java BigInteger Calculate saveToFile(String fileName, BigInteger mod, BigInteger exp)

Here you can find the source of saveToFile(String fileName, BigInteger mod, BigInteger exp)

Description

Save modulus and exponent of a key to file

License

Open Source License

Parameter

Parameter Description
fileName a parameter
mod Modulus
exp Exponent

Declaration

public static void saveToFile(String fileName, BigInteger mod, BigInteger exp) 

Method Source Code


//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();
                }
            }
        }
    }
}

Related

  1. removeDuplicates(final BigInteger... values)
  2. renderBigInteger(final BigInteger bint)
  3. retrieveBigInteger(final byte[] buf, final int offset)
  4. rightshift(byte b1, BigInteger b2)
  5. saveKey(File destDir, String fileName, BigInteger modulus, BigInteger publicExponent)
  6. serializeModexpNoBase(BigInteger[] modexp, boolean withResult)
  7. serializeModexpResponse(BigInteger response)
  8. serializeQuery(BigInteger modulus, BigInteger base, BigInteger exponent, boolean brief, String... modexps)
  9. shift(BigInteger integer, int distance)