HKDFunction { public static byte[] expandLabel(HKDFAlgorithm hkdfAlgortihm, byte[] prk, String labelIn, byte[] hashValue, int outLen) throws CryptoException { byte[] info = labelEncoder(hashValue, labelIn, outLen); return expand(hkdfAlgortihm, prk, info, outLen); } private  HKDFunction(); static byte[] extract(HKDFAlgorithm hkdfAlgortihm, byte[] salt, byte[] ikm); static byte[] expand(HKDFAlgorithm hkdfAlgortihm, byte[] prk, byte[] info, int outLen); static byte[] deriveSecret(HKDFAlgorithm hkdfAlgortihm, String hashAlgorithm, byte[] prk, String labelIn,
            byte[] toHash); static byte[] expandLabel(HKDFAlgorithm hkdfAlgortihm, byte[] prk, String labelIn, byte[] hashValue,
            int outLen); static final String KEY; static final String IV; static final String FINISHED; static final String DERIVED; static final String BINDER_KEY_EXT; static final String BINDER_KEY_RES; static final String CLIENT_EARLY_TRAFFIC_SECRET; static final String EARLY_EXPORTER_MASTER_SECRET; static final String CLIENT_HANDSHAKE_TRAFFIC_SECRET; static final String SERVER_HANDSHAKE_TRAFFIC_SECRET; static final String CLIENT_APPLICATION_TRAFFIC_SECRET; static final String SERVER_APPLICATION_TRAFFIC_SECRET; static final String EXPORTER_MASTER_SECRET; static final String ESNI_IV; static final String ESNI_KEY; static final String RESUMPTION_MASTER_SECRET; static final String RESUMPTION; }
@Test public void testExpandLabel() throws CryptoException { HKDFAlgorithm hkdfAlgorithm = HKDFAlgorithm.TLS_HKDF_SHA256; byte[] prk = ArrayConverter .hexStringToByteArray("E056D47C7DB9C04BBECE6AC9525163DE72B7D25B6B0899366F8FA741A5C01709"); byte[] hashValue = ArrayConverter.hexStringToByteArray(""); String labelIn = HKDFunction.KEY; int outLen = 16; byte[] result = HKDFunction.expandLabel(hkdfAlgorithm, prk, labelIn, hashValue, outLen); byte[] resultCorrect = ArrayConverter.hexStringToByteArray("04C5DA6EC39FC1653E085FA83E51C6AF"); assertArrayEquals(result, resultCorrect); }