Welcome to mirror list, hosted at ThFree Co, Russian Federation.

RainbowPrivateKeySpec.java « spec « jcajce « pqc « spongycastle « org « java « main « src « prov - gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8c854f5da77448e68185f0ea77eaac953b686909 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package org.spongycastle.pqc.jcajce.spec;

import java.security.spec.KeySpec;

import org.spongycastle.pqc.crypto.rainbow.Layer;

/**
 * This class provides a specification for a RainbowSignature private key.
 *
 * @see KeySpec
 */
public class RainbowPrivateKeySpec
    implements KeySpec
{
    /*
      * invertible affine linear map L1
      */
    // the inverse of A1, (n-v1 x n-v1 matrix)
    private short[][] A1inv;

    // translation vector of L1
    private short[] b1;

    /*
      * invertible affine linear map L2
      */
    // the inverse of A2, (n x n matrix)
    private short[][] A2inv;

    // translation vector of L2
    private short[] b2;

    /*
      * components of F
      */
    // the number of Vinegar-variables per layer.
    private int[] vi;

    // contains the polynomials with their coefficients of private map F
    private Layer[] layers;

    /**
     * Constructor
     *
     * @param A1inv  the inverse of A1(the matrix part of the affine linear map L1)
     *               (n-v1 x n-v1 matrix)
     * @param b1     translation vector, part of the linear affine map L1
     * @param A2inv  the inverse of A2(the matrix part of the affine linear map L2)
     *               (n x n matrix)
     * @param b2     translation vector, part of the linear affine map L2
     * @param vi     the number of Vinegar-variables per layer
     * @param layers the polynomials with their coefficients of private map F
     */
    public RainbowPrivateKeySpec(short[][] A1inv, short[] b1,
                                 short[][] A2inv, short[] b2, int[] vi, Layer[] layers)
    {
        this.A1inv = A1inv;
        this.b1 = b1;
        this.A2inv = A2inv;
        this.b2 = b2;
        this.vi = vi;
        this.layers = layers;
    }

    /**
     * Getter for the translation part of the private quadratic map L1.
     *
     * @return b1 the translation part of L1
     */
    public short[] getB1()
    {
        return this.b1;
    }

    /**
     * Getter for the inverse matrix of A1.
     *
     * @return the A1inv inverse
     */
    public short[][] getInvA1()
    {
        return this.A1inv;
    }

    /**
     * Getter for the translation part of the private quadratic map L2.
     *
     * @return b2 the translation part of L2
     */
    public short[] getB2()
    {
        return this.b2;
    }

    /**
     * Getter for the inverse matrix of A2
     *
     * @return the A2inv
     */
    public short[][] getInvA2()
    {
        return this.A2inv;
    }

    /**
     * Returns the layers contained in the private key
     *
     * @return layers
     */
    public Layer[] getLayers()
    {
        return this.layers;
    }

    /**
     * /** Returns the array of vi-s
     *
     * @return the vi
     */
    public int[] getVi()
    {
        return vi;
    }

}