blob: e63377c3a3e3a2e3bdffc056fe962b5371b71899 (
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
|
package org.bouncycastle.pqc.crypto.mceliece;
import org.bouncycastle.pqc.math.linearalgebra.GF2Matrix;
/**
*
*
*
*/
public class McElieceCCA2PublicKeyParameters
extends McElieceCCA2KeyParameters
{
// the OID of the algorithm
private String oid;
// the length of the code
private int n;
// the error correction capability of the code
private int t;
// the generator matrix
private GF2Matrix matrixG;
/**
* Constructor.
*
* @param n length of the code
* @param t error correction capability
* @param matrix generator matrix
* @param params McElieceCCA2Parameters
*/
public McElieceCCA2PublicKeyParameters(String oid, int n, int t, GF2Matrix matrix, McElieceCCA2Parameters params)
{
super(false, params);
this.oid = oid;
this.n = n;
this.t = t;
this.matrixG = new GF2Matrix(matrix);
}
/**
* Constructor (used by {@link McElieceKeyFactory}).
*
* @param n length of the code
* @param t error correction capability of the code
* @param encMatrix encoded generator matrix
* @param params McElieceCCA2Parameters
*/
public McElieceCCA2PublicKeyParameters(String oid, int n, int t, byte[] encMatrix, McElieceCCA2Parameters params)
{
super(false, params);
this.oid = oid;
this.n = n;
this.t = t;
this.matrixG = new GF2Matrix(encMatrix);
}
/**
* @return the length of the code
*/
public int getN()
{
return n;
}
/**
* @return the error correction capability of the code
*/
public int getT()
{
return t;
}
/**
* @return the generator matrix
*/
public GF2Matrix getMatrixG()
{
return matrixG;
}
/**
* @return the dimension of the code
*/
public int getK()
{
return matrixG.getNumRows();
}
public String getOIDString()
{
return oid;
}
}
|