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

org.bouncycastle.pqc.legacy.crypto.qtesla.QTESLAPublicKeyParameters 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.

The newest version!
package org.bouncycastle.pqc.legacy.crypto.qtesla;

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

/**
 * qTESLA public key
 */
public final class QTESLAPublicKeyParameters
    extends AsymmetricKeyParameter
{
    /**
     * qTESLA Security Category
     */
    private int securityCategory;

    /**
     * Text of the qTESLA Public Key
     */
    private byte[] publicKey;

    /**
     * Base constructor.
     *
     * @param securityCategory the security category for the passed in public key data.
     * @param publicKey the public key data.
     */
    public QTESLAPublicKeyParameters(int securityCategory, byte[] publicKey)
    {
        super(false);

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

        this.securityCategory = securityCategory;
        this.publicKey = Arrays.clone(publicKey);

    }

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

    /**
     * Return the key's public value.
     *
     * @return key public data.
     */
    public byte[] getPublicData()
    {
        return Arrays.clone(publicKey);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy