@@ -0,0 +1,1736 @@
+package at.archistar.crypto;%0A%0Aimport at.archistar.crypto.data.Share;%0Aimport at.archistar.crypto.decode.DecoderFactory;%0Aimport at.archistar.crypto.decode.ErasureDecoderFactory;%0Aimport at.archistar.crypto.math.GFFactory;%0Aimport at.archistar.crypto.math.gf256.GF256Factory;%0Aimport at.archistar.crypto.random.BCDigestRandomSource;%0Aimport at.archistar.crypto.secretsharing.ReconstructionException;%0Aimport at.archistar.crypto.secretsharing.SecretSharing;%0Aimport at.archistar.crypto.secretsharing.ShamirPSS;%0Aimport at.archistar.crypto.secretsharing.WeakSecurityException;%0A%0A/**%0A * This is a simple CryptoEngine that allows us to use ITS secret-sharing scheme.%0A * %0A * @author Andreas Happe %3Candreashappe@snikt.net%3E%0A */%0Apublic class ShamirEngine implements CryptoEngine %7B%0A%0A    /** our ITS Shamir secret-sharing scheme */%0A    private final SecretSharing shamir;%0A %0A    /**%0A     * initialize the crypto engine%0A     * %0A     * @param n total number of shares%0A     * @param k minimum count of shares needed to recreate the original data%0A     * %0A     * @throws WeakSecurityException if the k/n selection is insecure%0A     */%0A    public ShamirEngine(int n, int k) throws WeakSecurityException %7B%0A        %0A        GFFactory gffactory = new GF256Factory();%0A        DecoderFactory decoderFactory = new ErasureDecoderFactory(gffactory);%0A        BCDigestRandomSource rng = new BCDigestRandomSource();%0A        %0A        this.shamir = new ShamirPSS(n, k, rng, decoderFactory, gffactory.createHelper());%0A    %7D%0A    %0A    @Override%0A    public Share%5B%5D share(byte%5B%5D data) %7B%0A        return this.shamir.share(data);%0A    %7D%0A%0A    @Override%0A    public byte%5B%5D reconstruct(Share%5B%5D shares) throws ReconstructionException %7B%0A        return this.shamir.reconstruct(shares);%0A    %7D%0A%7D%0A

Add a simple Shamir Secret-Sharing Engine