@Test(expected=RuntimeException.class) public void testBadSki() { KeyUtils.extractSubjectKeyIdentifier(new byte[5]); }
public static byte[] extractSubjectKeyIdentifier(byte[] derSki) { byte[] dst = new byte[20]; if(derSki.length != 24) { throw new RuntimeException("DER-encoded SKI should be 24 bytes"); } System.arraycopy(derSki, 4, dst, 0, 20); return dst; }
KeyUtils { public static byte[] extractSubjectKeyIdentifier(byte[] derSki) { byte[] dst = new byte[20]; if(derSki.length != 24) { throw new RuntimeException("DER-encoded SKI should be 24 bytes"); } System.arraycopy(derSki, 4, dst, 0, 20); return dst; } }
KeyUtils { public static byte[] extractSubjectKeyIdentifier(byte[] derSki) { byte[] dst = new byte[20]; if(derSki.length != 24) { throw new RuntimeException("DER-encoded SKI should be 24 bytes"); } System.arraycopy(derSki, 4, dst, 0, 20); return dst; }  }
KeyUtils { public static byte[] extractSubjectKeyIdentifier(byte[] derSki) { byte[] dst = new byte[20]; if(derSki.length != 24) { throw new RuntimeException("DER-encoded SKI should be 24 bytes"); } System.arraycopy(derSki, 4, dst, 0, 20); return dst; }  static String getRsaPublicKeyFingerprint(RSAPublicKey pubKey, Provider provider); static String toHexPadded(byte[] data); static byte[] derEncodeBigInteger(BigInteger value); static byte[] derEncodeValue(byte type, byte[] bytes); static byte[] derEncodeRSAPublicKey(RSAPublicKey pubkey); static byte[] derEncodeSequence(List<byte[]> objects); static KeyPair rsaKeyPairFromBase64(String publicKey, String privateKey); static SecretKey decryptKey(String encodedKey, String algorithm, Provider provider, PrivateKey privateKey); static String encryptKey(SecretKey key, Provider provider, PublicKey publicKey); static String urlSafeEncodeBase64(byte[] data); static byte[] urlSafeDecodeBase64(String b64Data); static String signMetadata(Map<String, String> metadata,
            RSAPrivateKey privateKey, Provider provider); static byte[] extractSubjectKeyIdentifier(byte[] derSki); }
KeyUtils { public static byte[] extractSubjectKeyIdentifier(byte[] derSki) { byte[] dst = new byte[20]; if(derSki.length != 24) { throw new RuntimeException("DER-encoded SKI should be 24 bytes"); } System.arraycopy(derSki, 4, dst, 0, 20); return dst; }  static String getRsaPublicKeyFingerprint(RSAPublicKey pubKey, Provider provider); static String toHexPadded(byte[] data); static byte[] derEncodeBigInteger(BigInteger value); static byte[] derEncodeValue(byte type, byte[] bytes); static byte[] derEncodeRSAPublicKey(RSAPublicKey pubkey); static byte[] derEncodeSequence(List<byte[]> objects); static KeyPair rsaKeyPairFromBase64(String publicKey, String privateKey); static SecretKey decryptKey(String encodedKey, String algorithm, Provider provider, PrivateKey privateKey); static String encryptKey(SecretKey key, Provider provider, PublicKey publicKey); static String urlSafeEncodeBase64(byte[] data); static byte[] urlSafeDecodeBase64(String b64Data); static String signMetadata(Map<String, String> metadata,
            RSAPrivateKey privateKey, Provider provider); static byte[] extractSubjectKeyIdentifier(byte[] derSki);  }