Merge pull request #13 from apache/issue11

add coveralls
diff --git a/.dockerignore b/.dockerignore
index 7a408d6..c63cc95 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -3,10 +3,12 @@
 
 **/*~
 **/*bak
-model/sec256k1/__pycache__/
+log.txt
 
 build
-vagrant
 target
+incubator-milagro-crypto-c
+vagrant
 coverage
-incubator-milagro-crypto-c
\ No newline at end of file
+examples/scratch.c
+
diff --git a/.gitignore b/.gitignore
index e570758..35fd25b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,21 +1,11 @@
-build
-incubator-milagro-crypto-c
-
 **/*~
 **/*bak
-
-model/sec256k1/__pycache__/
-model/sec256k1/*.pyc
-model/examples/game.json
-model/vectors/*/__pycache__
-model/vectors/*/*.txt
-model/vectors/*/*.json
-
-vagrant/.vagrant
-target
-vagrant/repo
-
 log.txt
+
+build
+target
+incubator-milagro-crypto-c
+vagrant/.vagrant
 coverage
 examples/scratch.c
-model/examples/scratch.py
+
diff --git a/examples/example_dump_keys.c b/examples/example_dump_keys.c
index b5ff625..ccf0f84 100644
--- a/examples/example_dump_keys.c
+++ b/examples/example_dump_keys.c
@@ -50,14 +50,11 @@
     PAILLIER_public_key PUB1;
     PAILLIER_private_key PRIV2;
     PAILLIER_public_key PUB2;
+    PAILLIER_public_key PUB3;    
 
     // Paillier public key
     char n[FS_4096] = {0};
     octet N = {0,sizeof(n),n};
-    char g[FS_4096] = {0};
-    octet G = {0,sizeof(g),g};
-    char n2[FS_4096] = {0};
-    octet N2 = {0,sizeof(n2),n2};
 
     // Paillier private key
     char p[HFS_2048] = {0};
@@ -65,40 +62,23 @@
     char q[HFS_2048] = {0};
     octet Q = {0,sizeof(q),q};
 
-    char lp[HFS_2048] = {0};
-    octet LP = {0,sizeof(lp),lp};
-    char lq[HFS_2048] = {0};
-    octet LQ = {0,sizeof(lq),lq};
-
-    char invp[FS_2048] = {0};
-    octet INVP = {0,sizeof(invp),invp};
-    char invq[FS_2048] = {0};
-    octet INVQ = {0,sizeof(invq),invq};
-
-    char p2[FS_2048] = {0};
-    octet P2 = {0,sizeof(p2),p2};
-    char q2[FS_2048] = {0};
-    octet Q2 = {0,sizeof(q2),q2};
-
-    char mp[HFS_2048] = {0};
-    octet MP = {0,sizeof(mp),mp};
-    char mq[HFS_2048] = {0};
-    octet MQ = {0,sizeof(mq),mq};
-
     // Generating Paillier key pair
     PAILLIER_KEY_PAIR(&RNG, NULL, NULL, &PUB1, &PRIV1);
 
-    // Write public key to octets
-    MPC_DUMP_PAILLIER_PK(&PUB1, &N, &G, &N2);
+    // Write public key to octet
+    PAILLIER_PK_toOctet(&N, &PUB1);
 
-    // Read public key from octets
-    MPC_LOAD_PAILLIER_PK(&PUB2, &N, &G, &N2);
+    // Read public key from octet
+    PAILLIER_PK_fromOctet(&PUB2, &N);
 
+    FF_2048_toOctet(&P, PRIV1.p, HFLEN_2048);
+    FF_2048_toOctet(&Q, PRIV1.q, HFLEN_2048);
+    
     // Write secret key to octets
-    MPC_DUMP_PAILLIER_SK(&PRIV1, &P, &Q, &LP, &LQ, &INVP, &INVQ, &P2, &Q2, &MP, &MQ);
+    MPC_DUMP_PAILLIER_SK(&PRIV1, &P, &Q);
 
     // Read secret key from octets
-    MPC_LOAD_PAILLIER_SK(&PRIV2, &P, &Q, &LP, &LQ, &INVP, &INVQ, &P2, &Q2, &MP, &MQ);
+    PAILLIER_KEY_PAIR(NULL, &P, &Q, &PUB3, &PRIV2);
 
     char a1[FS_2048];
     octet A1 = {0,sizeof(a1),a1};
diff --git a/include/amcl/mpc.h b/include/amcl/mpc.h
index 8818ac7..1c3dd97 100644
--- a/include/amcl/mpc.h
+++ b/include/amcl/mpc.h
@@ -227,55 +227,14 @@
  */
 extern int MPC_PHASE5_verify(octet *U[2], octet *T[2]);
 
-/*! \brief Write Paillier public key to octets
- *
- *  @param   PUB              Paillier public key
- *  @param   N                Paillier Modulus - \f$ n = pq \f$
- *  @param   G                Public Base - \f$ g = n+1 \f$
- *  @param   N2               Precomputed \f$ n^2 \f$
- */
-void MPC_DUMP_PAILLIER_PK(PAILLIER_public_key *PUB, octet *N, octet *G, octet *N2);
-
-/*! \brief Load Paillier public key from octets
- *
- *  @param   PUB              Paillier public key
- *  @param   N                Paillier Modulus - \f$ n = pq \f$
- *  @param   G                Public Base - \f$ g = n+1 \f$
- *  @param   N2               Precomputed \f$ n^2 \f$
- */
-void MPC_LOAD_PAILLIER_PK(PAILLIER_public_key *PUB, octet *N, octet *G, octet *N2);
-
-/*! \brief Write Paillier secret key to octets
+/*! \brief Write Paillier keys to octets
  *
  *  @param   PRIV             Paillier secret key
  *  @param   P                Secret prime number
  *  @param   Q                Secret prime number
- *  @param   LP               Private Key modulo \f$ p \f$ (Euler totient of \f$ p \f$)
- *  @param   LQ               Private Key modulo \f$ q \f$ (Euler totient of \f$ q \f$)
- *  @param   INVP             Precomputed \f$ p^{-1} \pmod{2^m} \f$
- *  @param   INVQ             Precomputed \f$ q^{-1} \pmod{2^m} \f$
- *  @param   P2               Precomputed \f$ p^2 \f$
- *  @param   Q2               Precomputed \f$ q^2 \f$
- *  @param   MP               Precomputed \f$ L(g^{lp} \pmod{p^2})^{-1} \f$
- *  @param   MQ               Precomputed \f$ L(g^{lq} \pmod{q^2})^{-1} \f$
  */
-void MPC_DUMP_PAILLIER_SK(PAILLIER_private_key *PRIV, octet *P, octet *Q, octet *LP, octet *LQ, octet *INVP, octet *INVQ, octet *P2, octet *Q2, octet *MP, octet *MQ);
+void MPC_DUMP_PAILLIER_SK(PAILLIER_private_key *PRIV, octet *P, octet *Q);
 
-/*! \brief Load Paillier secret key from octets
- *
- *  @param   PRIV             Paillier secret key
- *  @param   P                Secret prime number
- *  @param   Q                Secret prime number
- *  @param   LP               Private Key modulo \f$ p \f$ (Euler totient of \f$ p \f$)
- *  @param   LQ               Private Key modulo \f$ q \f$ (Euler totient of \f$ q \f$)
- *  @param   INVP             Precomputed \f$ p^{-1} \pmod{2^m} \f$
- *  @param   INVQ             Precomputed \f$ q^{-1} \pmod{2^m} \f$
- *  @param   P2               Precomputed \f$ p^2 \f$
- *  @param   Q2               Precomputed \f$ q^2 \f$
- *  @param   MP               Precomputed \f$ L(g^{lp} \pmod{p^2})^{-1} \f$
- *  @param   MQ               Precomputed \f$ L(g^{lq} \pmod{q^2})^{-1} \f$
- */
-void MPC_LOAD_PAILLIER_SK(PAILLIER_private_key *PRIV, octet *P, octet *Q, octet *LP, octet *LQ, octet *INVP, octet *INVQ, octet *P2, octet *Q2, octet *MP, octet *MQ);
 
 #ifdef __cplusplus
 }
diff --git a/python/amcl_mpc.py b/python/amcl_mpc.py
index 18c9156..e138cbc 100755
--- a/python/amcl_mpc.py
+++ b/python/amcl_mpc.py
@@ -87,6 +87,9 @@
 
 extern void PAILLIER_KEY_PAIR(csprng *RNG, octet *P, octet* Q, PAILLIER_public_key *PUB, PAILLIER_private_key *PRIV);
 extern void PAILLIER_PRIVATE_KEY_KILL(PAILLIER_private_key *PRIV);
+extern void PAILLIER_PK_toOctet(octet *PK, PAILLIER_public_key *PUB);
+extern void PAILLIER_PK_fromOctet(PAILLIER_public_key *PUB, octet *PK);
+
 
 extern int  ECP_SECP256K1_KEY_PAIR_GENERATE(csprng *R,octet *s,octet *W);
 extern int  ECP_SECP256K1_PUBLIC_KEY_VALIDATE(octet *W);
@@ -102,10 +105,7 @@
 extern int MPC_S(octet *HM, octet *R, octet *K, octet *SIGMA, octet *S);
 extern void MPC_SUM_S(octet *S1, octet *S2, octet *S);
 extern int MPC_SUM_PK(octet *PK1, octet *PK2, octet *PK);
-extern void MPC_DUMP_PAILLIER_PK(PAILLIER_public_key *PUB, octet *N, octet *G, octet *N2);
-extern void MPC_LOAD_PAILLIER_PK(PAILLIER_public_key *PUB, octet *N, octet *G, octet *N2);
-extern void MPC_DUMP_PAILLIER_SK(PAILLIER_private_key *PRIV, octet *P, octet *Q, octet *LP, octet *LQ, octet *INVP, octet *INVQ, octet *P2, octet *Q2, octet *MP, octet *MQ);
-extern void MPC_LOAD_PAILLIER_SK(PAILLIER_private_key *PRIV, octet *P, octet *Q, octet *LP, octet *LQ, octet *INVP, octet *INVQ, octet *P2, octet *Q2, octet *MP, octet *MQ);
+extern void MPC_DUMP_PAILLIER_SK(PAILLIER_private_key *PRIV, octet *P, octet *Q);
 
 """)
 
@@ -292,6 +292,55 @@
 
     return 0
 
+
+def paillier_pk_to_octet(paillier_pk):    
+    """Write Paillier public key to byte array
+
+    Write Paillier public key to byte array
+
+    Args::
+
+        paillier_pk: Pointer to Paillier public key
+
+    Returns::
+
+        n: Paillier Modulus - n = pq
+
+    Raises:
+
+    """
+    n1, n1_val = make_octet(FS_4096)
+    
+    libamcl_paillier.PAILLIER_PK_toOctet(n1, paillier_pk)
+
+    n2 = to_str(n1)
+
+    return n2
+
+def paillier_pk_from_octet(n):    
+    """Read Paillier public key from byte array
+
+    Read Paillier public key from byte array
+
+    Args::
+
+        n: Paillier Modulus - n = pq
+
+    Returns::
+
+        paillier_pk: Pointer to Paillier public key
+
+    Raises:
+
+    """
+    paillier_pk = ffi.new('PAILLIER_public_key*')
+
+    n1, n1_val = make_octet(None, n)
+
+    libamcl_paillier.PAILLIER_PK_fromOctet(paillier_pk, n1)
+
+    return paillier_pk
+
 def ecp_secp256k1_key_pair_generate(rng, ecdsa_sk=None):
     """Generate ECDSA key pair
 
@@ -685,65 +734,6 @@
     
     return rc, pk2
 
-def mpc_dump_paillier_pk(paillier_pk):
-    """Write Paillier public key to byte array
-
-    Write Paillier public key to byte array
-
-    Args::
-
-        paillier_pk: Pointer to Paillier public key
-
-    Returns::
-
-        n: Paillier Modulus - n = pq
-        g: Public Base - g = n+1
-        n2: Precomputed - n^2 
-
-    Raises:
-
-    """
-    n1, n1_val = make_octet(FS_4096)
-    g1, g1_val = make_octet(FS_4096)
-    n21, n21_val = make_octet(FS_4096)    
-    
-    libamcl_mpc.MPC_DUMP_PAILLIER_PK(paillier_pk, n1, g1, n21)
-
-    n2 = to_str(n1)
-    g2 = to_str(g1)
-    n22 = to_str(n21)        
-
-    return n2, g2, n22
-
-def mpc_load_paillier_pk(n,g,n2):
-    """Read Paillier public key from byte arrays
-
-    Read Paillier public key from byte arrays
-
-    Args::
-
-        n: Paillier Modulus - n = pq
-        g: Public Base - g = n+1
-        n2: Precomputed - n^2 
-
-    Returns::
-
-        paillier_pk: Pointer to Paillier public key
-
-    Raises:
-
-    """
-    paillier_pk = ffi.new('PAILLIER_public_key*')
-
-    n1, n1_val = make_octet(None, n)
-    g1, g1_val = make_octet(None, g)
-    n21, n21_val = make_octet(None, n2)        
-
-
-    libamcl_mpc.MPC_LOAD_PAILLIER_PK(paillier_pk, n1, g1, n21)
-
-    return paillier_pk
-
 def mpc_dump_paillier_sk(paillier_sk):
     """Write Paillier public key to byte array
 
@@ -757,14 +747,6 @@
 
         p:           Secret prime number 
         q:           Secret prime number 
-        lp:          Private Key modulo \f$ p \f$ (Euler totient of \f$ p \f$)
-        lq:          Private Key modulo \f$ q \f$ (Euler totient of \f$ q \f$)
-        invp:        Precomputed \f$ p^{-1} \pmod{2^m} \f$
-        invq:        Precomputed \f$ q^{-1} \pmod{2^m} \f$
-        p2:          Precomputed \f$ p^2 \f$
-        q2:          Precomputed \f$ q^2 \f$ 
-        mp:          Precomputed \f$ L(g^{lp} \pmod{p^2})^{-1} \f$
-        mq:          Precomputed \f$ L(g^{lq} \pmod{q^2})^{-1} \f$
 
     Raises:
 
@@ -772,79 +754,9 @@
     p, p_val = make_octet(HFS_2048)
     q, q_val = make_octet(HFS_2048)    
 
-    lp, lp_val = make_octet(HFS_2048)
-    lq, lq_val = make_octet(HFS_2048)    
-
-    invp, invp_val = make_octet(FS_2048)
-    invq, invq_val = make_octet(FS_2048)    
-
-    pp2, pp2_val = make_octet(FS_2048)
-    qq2, qq2_val = make_octet(FS_2048)    
-    
-    mp, mp_val = make_octet(HFS_2048)
-    mq, mq_val = make_octet(HFS_2048)    
-    
-    libamcl_mpc.MPC_DUMP_PAILLIER_SK(paillier_sk, p, q, lp, lq, invp, invq, pp2, qq2, mp, mq)
+    libamcl_mpc.MPC_DUMP_PAILLIER_SK(paillier_sk, p, q)
 
     p2 = to_str(p)
     q2 = to_str(q)
 
-    lp2 = to_str(lp)
-    lq2 = to_str(lq)    
-
-    invp2 = to_str(invp)
-    invq2 = to_str(invq)    
-
-    p22 = to_str(pp2)
-    q22 = to_str(qq2)    
-
-    mp2 = to_str(mp)
-    mq2 = to_str(mq)    
-    
-    return p2, q2, lp2, lq2, invp2, invq2, p22, q22, mp2, mq2
-
-def mpc_load_paillier_sk(p, q, lp, lq, invp, invq, p2, q2, mp, mq):
-    """Read Paillier secret key from byte arrays
-
-    Read Paillier secret key from byte arrays
-
-    Args::
-
-        p:           Secret prime number 
-        q:           Secret prime number 
-        lp:          Private Key modulo \f$ p \f$ (Euler totient of \f$ p \f$)
-        lq:          Private Key modulo \f$ q \f$ (Euler totient of \f$ q \f$)
-        invp:        Precomputed \f$ p^{-1} \pmod{2^m} \f$
-        invq:        Precomputed \f$ q^{-1} \pmod{2^m} \f$
-        p2:          Precomputed \f$ p^2 \f$
-        q2:          Precomputed \f$ q^2 \f$ 
-        mp:          Precomputed \f$ L(g^{lp} \pmod{p^2})^{-1} \f$
-        mq:          Precomputed \f$ L(g^{lq} \pmod{q^2})^{-1} \f$
-
-    Returns::
-
-        paillier_sk: Pointer to Paillier secret key
-
-    Raises:
-
-    """
-    paillier_sk = ffi.new('PAILLIER_private_key*')
-
-    p1, p1_val = make_octet(None, p)
-    q1, q1_val = make_octet(None, q)   
-
-    lp1, lp1_val = make_octet(None, lp)
-    lq1, lq1_val = make_octet(None, lq)
-
-    invp1, invp1_val = make_octet(None, invp)
-    invq1, invq1_val = make_octet(None, invq)
-
-    p21, p21_val = make_octet(None, p2)
-    q21, q21_val = make_octet(None, q2)    
-    
-    mp1, mp1_val = make_octet(None, mp)
-    mq1, mq1_val = make_octet(None, mq)    
-
-    libamcl_mpc.MPC_LOAD_PAILLIER_SK(paillier_sk,  p1, q1, lp1, lq1, invp1, invq1, p21, q21, mp1, mq1)
-
-    return paillier_sk
+    return p2, q2
diff --git a/python/example_dump_keys.py b/python/example_dump_keys.py
index adbd008..71bff57 100755
--- a/python/example_dump_keys.py
+++ b/python/example_dump_keys.py
@@ -67,28 +67,17 @@
 
     # Dump and load Paillier public key
     
-    n, g, n2 = amcl_mpc.mpc_dump_paillier_pk(paillier_pk1)
+    n  = amcl_mpc.paillier_pk_to_octet(paillier_pk1)
     print(f"paillier_pk1.n {n.hex()}")
-    print(f"paillier_pk1.g {g.hex()}")
-    print(f"paillier_pk1.n2 {n2.hex()}")
 
-    paillier_pk2 = amcl_mpc.mpc_load_paillier_pk(n,g,n2)
+    paillier_pk2 = amcl_mpc.paillier_pk_from_octet(n)
 
     # Dump and load Paillier secret key
-    p, q, lp, lq, invp, invq, p2, q2, mp, mq = amcl_mpc.mpc_dump_paillier_sk(paillier_sk1)
+    p, q  = amcl_mpc.mpc_dump_paillier_sk(paillier_sk1)
     print(f"paillier_sk1.p {p.hex()}")
     print(f"paillier_sk1.q {q.hex()}")
-    print(f"paillier_sk1.lp {lp.hex()}")
-    print(f"paillier_sk1.lq {lq.hex()}")
-    print(f"paillier_sk1.invp {invp.hex()}")
-    print(f"paillier_sk1.invq {invq.hex()}")
-    print(f"paillier_sk1.p2 {p2.hex()}")
-    print(f"paillier_sk1.q2 {q2.hex()}")
-    print(f"paillier_sk1.mp {mp.hex()}")
-    print(f"paillier_sk1.mq {mq.hex()}")                                    
 
-
-    paillier_sk2 = amcl_mpc.mpc_load_paillier_sk(p, q, lp, lq, invp, invq, p2, q2, mp, mq)
+    paillier_pk3, paillier_sk2 = amcl_mpc.paillier_key_pair(rng, p, q)    
     
     ca = amcl_mpc.mpc_mta_client1(rng, paillier_pk2, a, r)
 
diff --git a/scripts/buildAMCL.sh b/scripts/buildAMCL.sh
index c6c7022..daff656 100755
--- a/scripts/buildAMCL.sh
+++ b/scripts/buildAMCL.sh
@@ -13,9 +13,10 @@
 
 git clone https://github.com/apache/incubator-milagro-crypto-c.git
 cd incubator-milagro-crypto-c
+git checkout 86c33c63d34fd3b9024a5e5c32934d4103805b9c
 mkdir build
 cd build
-cmake -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON -D AMCL_CHUNK=64 -D AMCL_CURVE="BLS381,SECP256K1" -D AMCL_RSA="" -D BUILD_PAILLIER=ON -D BUILD_PYTHON=ON -D BUILD_BLS=ON -D BUILD_WCC=OFF -D BUILD_MPIN=ON -D BUILD_X509=OFF -D CMAKE_INSTALL_PREFIX=/usr/local ..
+cmake -D CMAKE_BUILD_TYPE=Debug -D BUILD_SHARED_LIBS=ON -D AMCL_CHUNK=64 -D AMCL_CURVE="BLS381,SECP256K1" -D AMCL_RSA="" -D BUILD_PAILLIER=ON -D BUILD_PYTHON=ON -D BUILD_BLS=ON -D BUILD_WCC=OFF -D BUILD_MPIN=ON -D BUILD_X509=OFF -D CMAKE_INSTALL_PREFIX=/usr/local ..
 make
 make test
 sudo make install
diff --git a/src/mpc.c b/src/mpc.c
index d8729a9..b41039d 100644
--- a/src/mpc.c
+++ b/src/mpc.c
@@ -489,56 +489,10 @@
     return MPC_OK;
 }
 
-// Write Paillier public key to octets
-void MPC_DUMP_PAILLIER_PK(PAILLIER_public_key *PUB, octet *N, octet *G, octet *N2)
-{
-    FF_4096_toOctet(N,  PUB->n,  FFLEN_4096);
-    FF_4096_toOctet(G,  PUB->g,  FFLEN_4096);
-    FF_4096_toOctet(N2, PUB->n2, FFLEN_4096);
-}
-
-// Load Paillier public key from octets
-void MPC_LOAD_PAILLIER_PK(PAILLIER_public_key *PUB, octet *N, octet *G, octet *N2)
-{
-    FF_4096_fromOctet(PUB->n,  N,  FFLEN_4096);
-    FF_4096_fromOctet(PUB->g,  G,  FFLEN_4096);
-    FF_4096_fromOctet(PUB->n2, N2, FFLEN_4096);
-}
-
-// Write Paillier secret key to octets
-void MPC_DUMP_PAILLIER_SK(PAILLIER_private_key *PRIV, octet *P, octet *Q, octet *LP, octet *LQ, octet *INVP, octet *INVQ, octet *P2, octet *Q2, octet *MP, octet *MQ)
+// Write Paillier keys to octets
+void MPC_DUMP_PAILLIER_SK(PAILLIER_private_key *PRIV, octet *P, octet *Q)
 {
     FF_2048_toOctet(P, PRIV->p, HFLEN_2048);
     FF_2048_toOctet(Q, PRIV->q, HFLEN_2048);
-
-    FF_2048_toOctet(LP, PRIV->lp, HFLEN_2048);
-    FF_2048_toOctet(LQ, PRIV->lq, HFLEN_2048);
-
-    FF_2048_toOctet(INVP, PRIV->invp, FFLEN_2048);
-    FF_2048_toOctet(INVQ, PRIV->invq, FFLEN_2048);
-
-    FF_2048_toOctet(P2, PRIV->p2, FFLEN_2048);
-    FF_2048_toOctet(Q2, PRIV->q2, FFLEN_2048);
-
-    FF_2048_toOctet(MP, PRIV->mp, HFLEN_2048);
-    FF_2048_toOctet(MQ, PRIV->mq, HFLEN_2048);
 }
 
-// Load Paillier secret key from octets
-void MPC_LOAD_PAILLIER_SK(PAILLIER_private_key *PRIV, octet *P, octet *Q, octet *LP, octet *LQ, octet *INVP, octet *INVQ, octet *P2, octet *Q2, octet *MP, octet *MQ)
-{
-    FF_2048_fromOctet(PRIV->p, P, HFLEN_2048);
-    FF_2048_fromOctet(PRIV->q, Q, HFLEN_2048);
-
-    FF_2048_fromOctet(PRIV->lp, LP, HFLEN_2048);
-    FF_2048_fromOctet(PRIV->lq, LQ, HFLEN_2048);
-
-    FF_2048_fromOctet(PRIV->invp, INVP, FFLEN_2048);
-    FF_2048_fromOctet(PRIV->invq, INVQ, FFLEN_2048);
-
-    FF_2048_fromOctet(PRIV->p2, P2, FFLEN_2048);
-    FF_2048_fromOctet(PRIV->q2, Q2, FFLEN_2048);
-
-    FF_2048_fromOctet(PRIV->mp, MP, HFLEN_2048);
-    FF_2048_fromOctet(PRIV->mq, MQ, HFLEN_2048);
-}
diff --git a/test/smoke/test_dump_keys_smoke.c b/test/smoke/test_dump_keys_smoke.c
index 73642d4..751941d 100644
--- a/test/smoke/test_dump_keys_smoke.c
+++ b/test/smoke/test_dump_keys_smoke.c
@@ -52,7 +52,8 @@
     PAILLIER_public_key PUB1;
     PAILLIER_private_key PRIV2;
     PAILLIER_public_key PUB2;
-
+    PAILLIER_public_key PUB3;
+    
     char p[FS_2048] = {0};
     octet P = {0,sizeof(p),p};
 
@@ -98,10 +99,6 @@
     // Paillier public key
     char n[FS_4096] = {0};
     octet N = {0,sizeof(n),n};
-    char g[FS_4096] = {0};
-    octet G = {0,sizeof(g),g};
-    char n2[FS_4096] = {0};
-    octet N2 = {0,sizeof(n2),n2};
 
     // Paillier private key
     char pp[HFS_2048] = {0};
@@ -109,26 +106,6 @@
     char qq[HFS_2048] = {0};
     octet QQ = {0,sizeof(qq),qq};
 
-    char lp[HFS_2048] = {0};
-    octet LP = {0,sizeof(lp),lp};
-    char lq[HFS_2048] = {0};
-    octet LQ = {0,sizeof(lq),lq};
-
-    char invp[FS_2048] = {0};
-    octet INVP = {0,sizeof(invp),invp};
-    char invq[FS_2048] = {0};
-    octet INVQ = {0,sizeof(invq),invq};
-
-    char p2[FS_2048] = {0};
-    octet P2 = {0,sizeof(p2),p2};
-    char q2[FS_2048] = {0};
-    octet Q2 = {0,sizeof(q2),q2};
-
-    char mp[HFS_2048] = {0};
-    octet MP = {0,sizeof(mp),mp};
-    char mq[HFS_2048] = {0};
-    octet MQ = {0,sizeof(mq),mq};
-
     // Load values
     OCT_fromHex(&P,P_hex);
     printf("P: ");
@@ -173,17 +150,39 @@
     //  Paillier key pair
     PAILLIER_KEY_PAIR(NULL, &P, &Q, &PUB1, &PRIV1);
 
-    // Write public key to octets
-    MPC_DUMP_PAILLIER_PK(&PUB1, &N, &G, &N2);
+    // Write public key to octet
+    PAILLIER_PK_toOctet(&N, &PUB1);
 
-    // Read public key from octets
-    MPC_LOAD_PAILLIER_PK(&PUB2, &N, &G, &N2);
+    // Read public key from octet
+    PAILLIER_PK_fromOctet(&PUB2, &N);
 
     // Write secret key to octets
-    MPC_DUMP_PAILLIER_SK(&PRIV1, &PP, &QQ, &LP, &LQ, &INVP, &INVQ, &P2, &Q2, &MP, &MQ);
+    MPC_DUMP_PAILLIER_SK(&PRIV1, &PP, &QQ);
 
+    printf("PP: ");
+    OCT_output(&PP);
+    printf("\n");
+
+    rc = OCT_comp(&P,&PP);
+    if(!rc)
+    {
+        fprintf(stderr, "FAILURE PP != P rc: %d\n", rc);
+        exit(EXIT_FAILURE);
+    }
+
+    printf("QQ: ");
+    OCT_output(&QQ);
+    printf("\n");
+
+    rc = OCT_comp(&Q,&QQ);
+    if(!rc)
+    {
+        fprintf(stderr, "FAILURE QQ != Q rc: %d\n", rc);
+        exit(EXIT_FAILURE);
+    }
+    
     // Read secret key from octets
-    MPC_LOAD_PAILLIER_SK(&PRIV2, &PP, &QQ, &LP, &LQ, &INVP, &INVQ, &P2, &Q2, &MP, &MQ);
+    PAILLIER_KEY_PAIR(NULL, &PP, &QQ, &PUB3, &PRIV2);    
 
     MPC_MTA_CLIENT1(NULL, &PUB2, &A, &CA, &R);
 
diff --git a/vagrant/README.md b/vagrant/README.md
index aa27d3b..4a38937 100755
--- a/vagrant/README.md
+++ b/vagrant/README.md
@@ -35,7 +35,7 @@
 in this directory and then on the VM
 
 ```
-mv /vagarnt/libmpc $HOME
+mv /vagarnt/incubator-milagro-MPC $HOME
 ```
 
 ## Commands
diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh
index 41bd3a2..2002f4a 100755
--- a/vagrant/bootstrap.sh
+++ b/vagrant/bootstrap.sh
@@ -5,14 +5,18 @@
 sudo apt-get install -y build-essential cmake doxygen lcov python3-dev python3-pip wget git emacs
 sudo apt-get clean
 
-echo "install docker"
-curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
-sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
-sudo apt-get update && sudo apt-get install apt-transport-https ca-certificates curl software-properties-common docker-ce -y
-sudo apt-get update && sudo apt-get install docker-ce -y
-sudo curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
-sudo chmod +x /usr/local/bin/docker-compose
-sudo usermod -aG docker vagrant
+## docker
+sudo groupadd docker
+sudo usermod -aG docker $USER
+groups $USER
+sudo snap install docker
+# You will also need to re-enter the session for the group update to take place
+# su - $USER
+# Above command will not work as do not know password. Instead do these commands.
+# vagrant halt
+# vagrant up
+
+#docker info
 
 # install AMCL
 git clone https://github.com/apache/incubator-milagro-crypto-c.git
@@ -24,3 +28,12 @@
 make test
 sudo make install
 
+# intall libmpc
+git clone https://github.com/apache/incubator-milagro-MPC.git 
+cd incubator-milagro-MPC
+mkdir build
+cd build
+cmake -D CMAKE_INSTALL_PREFIX=/usr/local ..
+make
+make test
+sudo make install