summary refs log tree commit diff
path: root/crypto/src/pqc/crypto/bike/BikePrivateKeyParameters.cs
blob: d8c6e46133f75969d7aa7f12afc3424b6d77fa18 (plain) (blame)
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
using Org.BouncyCastle.Utilities;
using System;
using System.Collections.Generic;
using System.Text;

namespace Org.BouncyCastle.Pqc.Crypto.Bike
{
    public class BikePrivateKeyParameters : BikeKeyParameters
    {
        // h0
        private byte[] h0;

        // h1
        private byte[] h1;

        // sigma
        private byte[] sigma;

        /**
         * Constructor.
         *
         * @param h0    h0
         * @param h1    h1
         * @param sigma random bytes sigma
         */
        public BikePrivateKeyParameters(BikeParameters bikeParameters, byte[] h0, byte[] h1, byte[] sigma) : base(true, bikeParameters)
        {
            this.h0 = Arrays.Clone(h0);
            this.h1 = Arrays.Clone(h1);
            this.sigma = Arrays.Clone(sigma);
        }

        public byte[] GetH0()
        {
            return h0;
        }

        public byte[] GetH1()
        {
            return h1;
        }

        public byte[] GetSigma()
        {
            return sigma;
        }

        public byte[] PrivateKey => Arrays.Concatenate(Arrays.Concatenate(h0, h1), sigma);

        public byte[] GetEncoded()
        {
            return PrivateKey;
        }
    }
}