mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-22 06:17:56 +00:00
Updated unit tests and removed magic number
This commit is contained in:
parent
00d8dfb3b5
commit
4cf08ef38a
@ -26,6 +26,7 @@ public class CertificateAuthorityCredential extends Certificate {
|
|||||||
public static final String SUBJECT_KEY_IDENTIFIER_FIELD = "subjectKeyIdentifier";
|
public static final String SUBJECT_KEY_IDENTIFIER_FIELD = "subjectKeyIdentifier";
|
||||||
|
|
||||||
private static final int CA_BYTE_SIZE = 20;
|
private static final int CA_BYTE_SIZE = 20;
|
||||||
|
private static final int PREFIX_BYTE_SIZE = 4;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
private final byte[] subjectKeyIdentifier;
|
private final byte[] subjectKeyIdentifier;
|
||||||
@ -163,7 +164,7 @@ public class CertificateAuthorityCredential extends Certificate {
|
|||||||
|
|
||||||
private byte[] truncatePrefixBytes(final byte[] certificateBytes) {
|
private byte[] truncatePrefixBytes(final byte[] certificateBytes) {
|
||||||
byte[] temp = new byte[CA_BYTE_SIZE];
|
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;
|
return temp;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ public class CertificateTest {
|
|||||||
* Hex-encoded subject key identifier for the FAKE_ROOT_CA_FILE.
|
* Hex-encoded subject key identifier for the FAKE_ROOT_CA_FILE.
|
||||||
*/
|
*/
|
||||||
public static final String FAKE_ROOT_CA_SUBJECT_KEY_IDENTIFIER_HEX =
|
public static final String FAKE_ROOT_CA_SUBJECT_KEY_IDENTIFIER_HEX =
|
||||||
"0416041458ec313a1699f94c1c8c4e2c6412402b258f0177";
|
"58ec313a1699f94c1c8c4e2c6412402b258f0177";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Location of a test STM endorsement credential.
|
* Location of a test STM endorsement credential.
|
||||||
|
Loading…
Reference in New Issue
Block a user