@Test
public void getSignedByIssuer_setsSubjectKeyIdentifier() throws Exception {

  final X509Certificate generatedCertificate = subject
    .getSignedByIssuer(generatedCertificateKeyPair, certificateGenerationParameters,
      certificateAuthorityWithSubjectKeyId, issuerKey.getPrivate());
  expectedSubjectKeyIdentifier = jcaX509ExtensionUtils.createSubjectKeyIdentifier(generatedCertificateKeyPair.getPublic()).getKeyIdentifier();
  final byte[] actual = generatedCertificate.getExtensionValue(Extension.subjectKeyIdentifier.getId());
  // four bit type field is added at the beginning as per RFC 5280
  assertThat(Arrays.copyOfRange(actual, 4, actual.length), equalTo(expectedSubjectKeyIdentifier));
}