@Test public void testSmallPlaintextWithMultipleKeys() throws Exception { byte[] primaryKeyValue = Random.randBytes(KEY_SIZE); Keyset.Key primary = TestUtil.createKey( TestUtil.createPrfKeyData(primaryKeyValue), 5, KeyStatusType.ENABLED, OutputPrefixType.RAW); byte[] secondaryKeyValue = Random.randBytes(KEY_SIZE); Keyset.Key secondary = TestUtil.createKey( TestUtil.createPrfKeyData(secondaryKeyValue), 6, KeyStatusType.ENABLED, OutputPrefixType.RAW); KeysetHandle keysetHandle = TestUtil.createKeysetHandle(TestUtil.createKeyset(primary, secondary)); byte[] plaintext = "blah".getBytes(UTF_8); PrfSet prfSet = new PrfSetWrapper().wrap(Registry.getPrimitives(keysetHandle, PrfSet.class)); byte[] prsPrimary = prfSet.computePrimary(plaintext, 12); byte[] prs5 = prfSet.getPrfs().get(5).compute(plaintext, 12); byte[] prs6 = prfSet.getPrfs().get(6).compute(plaintext, 12); assertEquals(5, prfSet.getPrimaryId()); assertThat(prfSet.getPrfs()).hasSize(2); assertThat(prsPrimary).hasLength(12); assertArrayEquals(prs5, prsPrimary); assertThat(prsPrimary).isNotEqualTo(prs6); }
@Override public PrfSet wrap(PrimitiveSet<PrfSet> set) throws GeneralSecurityException { return new WrappedPrfSet(set); }
PrfSetWrapper implements PrimitiveWrapper<PrfSet, PrfSet> { @Override public PrfSet wrap(PrimitiveSet<PrfSet> set) throws GeneralSecurityException { return new WrappedPrfSet(set); } }
PrfSetWrapper implements PrimitiveWrapper<PrfSet, PrfSet> { @Override public PrfSet wrap(PrimitiveSet<PrfSet> set) throws GeneralSecurityException { return new WrappedPrfSet(set); }  }
PrfSetWrapper implements PrimitiveWrapper<PrfSet, PrfSet> { @Override public PrfSet wrap(PrimitiveSet<PrfSet> set) throws GeneralSecurityException { return new WrappedPrfSet(set); }  @Override PrfSet wrap(PrimitiveSet<PrfSet> set); @Override Class<PrfSet> getPrimitiveClass(); @Override Class<PrfSet> getInputPrimitiveClass(); static void register(); }
PrfSetWrapper implements PrimitiveWrapper<PrfSet, PrfSet> { @Override public PrfSet wrap(PrimitiveSet<PrfSet> set) throws GeneralSecurityException { return new WrappedPrfSet(set); }  @Override PrfSet wrap(PrimitiveSet<PrfSet> set); @Override Class<PrfSet> getPrimitiveClass(); @Override Class<PrfSet> getInputPrimitiveClass(); static void register();  }