コード例 #1
0
ファイル: Cpabe.java プロジェクト: darkscout/cpabe
  public void keygen(String pubfile, String prvfile, String mskfile, String attr_str)
      throws NoSuchAlgorithmException, IOException {
    BswabePub pub;
    BswabeMsk msk;
    byte[] pub_byte, msk_byte, prv_byte;

    /* get BswabePub from pubfile */
    pub_byte = Common.suckFile(pubfile);
    pub = new BswabePub();
    pub.initFromBuffer(pub_byte);

    /* get BswabeMsk from mskfile */
    msk_byte = Common.suckFile(mskfile);
    msk = new BswabeMsk(pub);
    msk.initFromBuffer(msk_byte);

    String[] attr_arr = LangPolicy.parseAttribute(attr_str);
    BswabePrv prv = Bswabe.keygen(pub, msk, attr_arr);

    /* store BswabePrv into prvfile */
    prv_byte = prv.serialize();
    Common.spitFile(prvfile, prv_byte);
  }