예제 #1
0
 @Test
 public void emptyCiphertext() throws GeneralSecurityException {
   Biscuit biscuit = new Biscuit.Builder().build();
   assertNull(biscuit.get("404"));
   assertNull(biscuit.getString("404"));
   biscuit.read(new StringReader("k:\n- algorithm: none\n  ciphertext: \"\""));
   biscuit.read(new StringReader("no_ciphertext:\n- algorithm: none\n"));
   assertNull(biscuit.get("404"));
   assertNull(biscuit.getString("404"));
   assertNotNull(biscuit.get("no_ciphertext"));
   assertNotNull(biscuit.getString("no_ciphertext"));
   assertNotNull(biscuit.get("k"));
   assertNotNull(biscuit.getString("k"));
 }
예제 #2
0
 @Test
 public void secretsFromReader() throws GeneralSecurityException {
   Biscuit biscuit = new Biscuit.Builder().build();
   biscuit.read(
       new InputStreamReader(
           getClass().getResourceAsStream("secrets.yml"), Charset.forName("UTF-8")));
   commonTests(biscuit);
 }
예제 #3
0
 @Test
 public void missingKeys() throws GeneralSecurityException {
   Biscuit biscuit = new Biscuit.Builder().build();
   assertNull(biscuit.get("404"));
   biscuit.read(new StringReader("k:\n- algorithm: none\n  ciphertext: aGVsbG8K"));
   assertNull(biscuit.get("404"));
   assertNull(biscuit.getString("404"));
   assertNotNull(biscuit.get("k"));
   assertNotNull(biscuit.getString("k"));
 }
예제 #4
0
 @Test
 public void testUnknownKeyManager() throws GeneralSecurityException {
   Biscuit biscuit = new Biscuit.Builder().build();
   biscuit.read(new StringReader("k:\n- key_manager: kms\n  algorithm: secretbox\n"));
   assertNull(biscuit.get("k"));
 }
예제 #5
0
 @Test
 public void testUnknownAlgorithm() throws GeneralSecurityException {
   Biscuit biscuit = new Biscuit.Builder().build();
   biscuit.read(new StringReader("k:\n- algorithm: 3des\n  ciphertext: aGVsbG8K"));
   assertNull(biscuit.get("k"));
 }