//package IM;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.security.PrivateKey;
import java.security.Signature;
import java.security.SignedObject;

class ClearRL {
    public static void main(String args[]) {
        try {
            String rl[] = new String[0];
            FileOutputStream fos = new FileOutputStream("revocationlist");
            ObjectOutputStream objout = new ObjectOutputStream(fos);
            objout.writeObject(rl);
            objout.flush();
            objout.close();
            fos.close();
        } catch (Exception e) {
            System.out.print("Error\n");
        }
    }

    public static void clear() {
        try {
            String[] rl = new String[0];
            //Serializable srl = rl;
            Signature signature = Signature.getInstance("SHA1withRSA");
            PrivateKey ca_PrivateKey = Helper.readPrivateKey("ca");
            SignedObject signedList = new SignedObject(rl, ca_PrivateKey, signature);
            FileOutputStream fos = new FileOutputStream(Helper.R_LIST);
            ObjectOutputStream objout = new ObjectOutputStream(fos);
            objout.writeObject(signedList);
            objout.flush();
            objout.close();
            fos.close();
        } catch (Exception e) {
            System.out.print("Error\n");
        }
    }
}
