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

org.bouncycastle.tls.UseSRTPData Maven / Gradle / Ivy

Go to download

The Bouncy Castle Java APIs for the TLS, including a JSSE provider. The APIs are designed primarily to be used in conjunction with the BC FIPS provider. The APIs may also be used with other providers although if being used in a FIPS context it is the responsibility of the user to ensure that any other providers used are FIPS certified and used appropriately.

There is a newer version: 2.0.19
Show newest version
package org.bouncycastle.tls;

/**
 * RFC 5764 4.1.1
 */
public class UseSRTPData
{
    protected int[] protectionProfiles;
    protected byte[] mki;

    /**
     * @param protectionProfiles see {@link SRTPProtectionProfile} for valid constants.
     * @param mki                valid lengths from 0 to 255.
     */
    public UseSRTPData(int[] protectionProfiles, byte[] mki)
    {
        if (TlsUtils.isNullOrEmpty(protectionProfiles) || protectionProfiles.length >= (1 << 15))
        {
            throw new IllegalArgumentException("'protectionProfiles' must have length from 1 to (2^15 - 1)");
        }

        if (mki == null)
        {
            mki = TlsUtils.EMPTY_BYTES;
        }
        else if (mki.length > 255)
        {
            throw new IllegalArgumentException("'mki' cannot be longer than 255 bytes");
        }

        this.protectionProfiles = protectionProfiles;
        this.mki = mki;
    }

    /**
     * @return see {@link SRTPProtectionProfile} for valid constants.
     */
    public int[] getProtectionProfiles()
    {
        return protectionProfiles;
    }

    /**
     * @return valid lengths from 0 to 255.
     */
    public byte[] getMki()
    {
        return mki;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy