All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bouncycastle.pqc.crypto.qteslarnd1.QTESLAPrivateKeyParameters Maven / Gradle / Ivy

Go to download

The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5 to JDK 1.8.

There is a newer version: 1.79
Show newest version
package org.bouncycastle.pqc.crypto.qteslarnd1;

import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.bouncycastle.util.Arrays;

/**
 * qTESLA private key
 */
public final class QTESLAPrivateKeyParameters
    extends AsymmetricKeyParameter
{
    /**
     * qTESLA Security Category (From 4 To 8)
     */
    private int securityCategory;

    /**
     * Text of the qTESLA Private Key
     */
    private byte[] privateKey;

    /**
     * Base constructor.
     *
     * @param securityCategory the security category for the passed in public key data.
     * @param privateKey the private key data.
     */
    public QTESLAPrivateKeyParameters(int securityCategory, byte[] privateKey)
    {
        super(true);

        if (privateKey.length != QTESLASecurityCategory.getPrivateSize(securityCategory))
        {
            throw new IllegalArgumentException("invalid key size for security category");
        }

        this.securityCategory = securityCategory;
        this.privateKey = Arrays.clone(privateKey);
    }

    /**
     * Return the security category for this key.
     *
     * @return the key's security category.
     */
    public int getSecurityCategory()
    {
        return this.securityCategory;
    }

    /**
     * Return the key's secret value.
     *
     * @return key private data.
     */
    public byte[] getSecret()
    {
        return Arrays.clone(privateKey);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy