Search in sources :

Example 6 with JwtHmacKeyFormat

use of com.google.crypto.tink.proto.JwtHmacKeyFormat in project tink by google.

the class JwtHmacKeyManagerTest method testHs256Template.

@Test
public void testHs256Template() throws Exception {
    KeyTemplate template = KeyTemplates.get("JWT_HS256");
    assertThat(template.getTypeUrl()).isEqualTo(manager.getKeyType());
    assertThat(template.getOutputPrefixType()).isEqualTo(KeyTemplate.OutputPrefixType.TINK);
    JwtHmacKeyFormat format = JwtHmacKeyFormat.parseFrom(template.getValue(), ExtensionRegistryLite.getEmptyRegistry());
    assertThat(format.getKeySize()).isEqualTo(32);
    assertThat(format.getAlgorithm()).isEqualTo(JwtHmacAlgorithm.HS256);
}
Also used : JwtHmacKeyFormat(com.google.crypto.tink.proto.JwtHmacKeyFormat) KeyTemplate(com.google.crypto.tink.KeyTemplate) Test(org.junit.Test)

Aggregations

JwtHmacKeyFormat (com.google.crypto.tink.proto.JwtHmacKeyFormat)6 Test (org.junit.Test)6 KeyTemplate (com.google.crypto.tink.KeyTemplate)4 JwtHmacKey (com.google.crypto.tink.proto.JwtHmacKey)1 ByteString (com.google.protobuf.ByteString)1 TreeSet (java.util.TreeSet)1 DataPoint (org.junit.experimental.theories.DataPoint)1