Package com.securityinnovation.jNeo.ntruencrypt

Examples of com.securityinnovation.jNeo.ntruencrypt.KeyParams


       
        // Do the setup inside a try statement so we don't accidentally
        // trigger a false positive.
        try {
            int t = 0;
            KeyParams keyParams = KeyParams.getKeyParams(tests[t].oid);

            // Build a blob and make a short copy of it
            byte blob[] = buildPrivBlob(
                keyParams, tests[0].packedH, tests[0].packedListedF);
            blob2 = new byte[blob.length-2];
View Full Code Here


       
        // Do the setup inside a try statement so we don't accidentally
        // trigger a false positive.
        try {
            int t = 0;
            KeyParams keyParams = KeyParams.getKeyParams(tests[t].oid);

            // Build a blob and make a long copy of it
            byte blob[] = buildPrivBlob(
                keyParams, tests[0].packedH, tests[0].packedListedF);
            blob2 = new byte[blob.length+2];
View Full Code Here

        throws ParamSetNotSupportedException
    {
        // Parse the header, recover the key parameters.
        if (keyBlob[0] != tag)
          throw new IllegalArgumentException("key blob tag not recognized");
        KeyParams keyParams = KeyFormatterUtil.parseOID(keyBlob, 1, 3);

        // Make sure the input will be fully consumed
        int headerLen = KeyFormatterUtil.getHeaderEndOffset(keyBlob);
        int packedHLen = BitPack.unpack(keyParams.N, keyParams.q);
        if (headerLen + packedHLen != keyBlob.length)
View Full Code Here

        throws ParamSetNotSupportedException
    {
        NtruEncryptTestVector tests[] = NtruEncryptTestVector.getTestVectors();
        for (int t=0; t<tests.length; t++)
        {
            KeyParams keyParams = KeyParams.getKeyParams(tests[t].oid);
            FullPolynomial expected = new FullPolynomial(tests[t].r);
            IGF2 igf = new IGF2(
                keyParams.N, keyParams.c, keyParams.igfHash, 1,
                tests[t].sData, 0, tests[t].sData.length);
            FullPolynomial out = BPGM3.genTrinomial(
View Full Code Here

    {
        byte inData[] = new byte[10];
        java.util.Arrays.fill(inData, (byte)0);
        byte oidBytes[] = OIDMap.getOIDBytes(oid);
        System.arraycopy(oidBytes, 0, inData, 2, oidBytes.length);
        KeyParams p = KeyFormatterUtil.parseOID(inData, 2, oidBytes.length);
        return (p == KeyParams.getKeyParams(oid));
    }
View Full Code Here

    @Test public void test_recoverF()
        throws NtruException
    {
        for (int t=0; t<tests.length; t++)
        {
            KeyParams keyParams = KeyParams.getKeyParams(tests[t].oid);
            FullPolynomial f = new FullPolynomial(tests[t].f);
            // get f into the expected form:
            // The test vectors have coefficients of f in [0..q-1]
            // recoverF expects them in the range [-q/2..q/2)
            for (int i=0; i<f.p.length; i++)
View Full Code Here

    @Test public void test_encodePrivKey()
        throws NtruException
    {
        for (int t=0; t<tests.length; t++)
        {
            KeyParams keyParams = KeyParams.getKeyParams(tests[t].oid);
            FullPolynomial h = new FullPolynomial(tests[t].h);
            FullPolynomial f = recoverf(tests[t].f, keyParams.q);

            // Build the test blob
            PrivKeyFormatter encoder = new PrivKeyFormatter_PrivateKeyPackedFv1();
View Full Code Here

    public void test_decodePubKey()
        throws NtruException
    {
        for (int t=0; t<tests.length; t++)
        {
            KeyParams keyParams = KeyParams.getKeyParams(tests[t].oid);

            // Build a blob
            byte blob[] = buildPrivBlob(
                keyParams, tests[t].packedH, tests[t].packedF);
           
View Full Code Here

        throws ParamSetNotSupportedException
    {
        NtruEncryptTestVector tests[] = NtruEncryptTestVector.getTestVectors();
        for (int t=0; t<tests.length; t++)
        {
            KeyParams keyParams = KeyParams.getKeyParams(tests[t].oid);
            FullPolynomial r = new FullPolynomial(tests[t].r);
            FullPolynomial h = new FullPolynomial(tests[t].h);
            FullPolynomial R = new FullPolynomial(tests[t].R);

            FullPolynomial out = FullPolynomial.convolution(r, h, keyParams.q);
View Full Code Here

    {
        byte             blob[] = null;
        PrivKeyFormatter encoder = null;
        try {
            int t = 0;
            KeyParams keyParams = KeyParams.getKeyParams(tests[t].oid);

            // Build a blob
            blob = buildPrivBlob(
                keyParams, tests[t].packedH, tests[t].packedF);
            // Change the oid
View Full Code Here

TOP

Related Classes of com.securityinnovation.jNeo.ntruencrypt.KeyParams

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.