Updated unit tests and removed magic number

This commit is contained in:
Cyrus 2022-02-23 08:45:16 -05:00
parent 00d8dfb3b5
commit 4cf08ef38a
2 changed files with 3 additions and 2 deletions

View File

@ -26,6 +26,7 @@ public class CertificateAuthorityCredential extends Certificate {
public static final String SUBJECT_KEY_IDENTIFIER_FIELD = "subjectKeyIdentifier";
private static final int CA_BYTE_SIZE = 20;
private static final int PREFIX_BYTE_SIZE = 4;
@Column
private final byte[] subjectKeyIdentifier;
@ -163,7 +164,7 @@ public class CertificateAuthorityCredential extends Certificate {
private byte[] truncatePrefixBytes(final byte[] certificateBytes) {
byte[] temp = new byte[CA_BYTE_SIZE];
System.arraycopy(certificateBytes, 4, temp, 0, CA_BYTE_SIZE);
System.arraycopy(certificateBytes, PREFIX_BYTE_SIZE, temp, 0, CA_BYTE_SIZE);
return temp;
}

View File

@ -77,7 +77,7 @@ public class CertificateTest {
* Hex-encoded subject key identifier for the FAKE_ROOT_CA_FILE.
*/
public static final String FAKE_ROOT_CA_SUBJECT_KEY_IDENTIFIER_HEX =
"0416041458ec313a1699f94c1c8c4e2c6412402b258f0177";
"58ec313a1699f94c1c8c4e2c6412402b258f0177";
/**
* Location of a test STM endorsement credential.