1 package club.wpia.gigi.crypto.key;
3 import static org.junit.Assert.*;
5 import java.io.IOException;
6 import java.security.GeneralSecurityException;
7 import java.security.PublicKey;
11 import sun.security.util.DerValue;
12 import sun.security.x509.X509Key;
13 import club.wpia.gigi.GigiApiException;
14 import club.wpia.gigi.util.PEM;
16 public class KeyCheckTest {
18 public static PublicKey pkFromString(String pub) throws GeneralSecurityException, IOException {
19 byte[] data = PEM.decode("PUBLIC KEY", pub);
20 DerValue der = new DerValue(data);
21 PublicKey key = X509Key.parse(der);
27 public void testNullKey() {
29 KeyCheck.checkKey(null);
30 fail("Providing a null key should fail!");
31 } catch (GigiApiException gae) {