use of com.hedera.mirror.importer.domain.FileStreamSignature in project hedera-mirror-node by hashgraph.
the class NodeSignatureVerifierTest method testNoFileHashSignature.
@Test
void testNoFileHashSignature() throws GeneralSecurityException {
byte[] fileHash = TestUtils.generateRandomByteArray(48);
FileStreamSignature fileStreamSignature = buildFileStreamSignature(fileHash, null, null, null);
List<FileStreamSignature> fileStreamSignatures = Arrays.asList(fileStreamSignature);
Exception e = assertThrows(SignatureVerificationException.class, () -> nodeSignatureVerifier.verify(fileStreamSignatures));
assertTrue(e.getMessage().contains("Signature verification failed for file"));
}
use of com.hedera.mirror.importer.domain.FileStreamSignature in project hedera-mirror-node by hashgraph.
the class NodeSignatureVerifierTest method buildBareBonesFileStreamSignature.
private FileStreamSignature buildBareBonesFileStreamSignature() {
FileStreamSignature fileStreamSignature = new FileStreamSignature();
fileStreamSignature.setFilename("");
fileStreamSignature.setNodeAccountId(nodeId);
fileStreamSignature.setSignatureType(SignatureType.SHA_384_WITH_RSA);
fileStreamSignature.setStreamType(StreamType.RECORD);
return fileStreamSignature;
}
use of com.hedera.mirror.importer.domain.FileStreamSignature in project hedera-mirror-node by hashgraph.
the class NodeSignatureVerifierTest method testNoSignatureType.
@Test
void testNoSignatureType() throws GeneralSecurityException {
byte[] fileHash = TestUtils.generateRandomByteArray(48);
FileStreamSignature fileStreamSignature = buildFileStreamSignature(fileHash, signHash(fileHash), null, null);
fileStreamSignature.setSignatureType(null);
List<FileStreamSignature> fileStreamSignatures = Arrays.asList(fileStreamSignature);
Exception e = assertThrows(SignatureVerificationException.class, () -> nodeSignatureVerifier.verify(fileStreamSignatures));
assertTrue(e.getMessage().contains("Signature verification failed for file"));
}
use of com.hedera.mirror.importer.domain.FileStreamSignature in project hedera-mirror-node by hashgraph.
the class NodeSignatureVerifierTest method testV5FileStreamSignature.
@Test
void testV5FileStreamSignature() throws GeneralSecurityException {
byte[] fileHash = TestUtils.generateRandomByteArray(48);
byte[] metadataHash = TestUtils.generateRandomByteArray(48);
FileStreamSignature fileStreamSignature = buildFileStreamSignature(fileHash, signHash(fileHash), metadataHash, signHash(metadataHash));
nodeSignatureVerifier.verify(Arrays.asList(fileStreamSignature));
}
use of com.hedera.mirror.importer.domain.FileStreamSignature in project hedera-mirror-node by hashgraph.
the class NodeSignatureVerifierTest method testNoFileHash.
@Test
void testNoFileHash() throws GeneralSecurityException {
byte[] fileHash = TestUtils.generateRandomByteArray(48);
FileStreamSignature fileStreamSignature = buildFileStreamSignature(null, signHash(fileHash), null, null);
List<FileStreamSignature> fileStreamSignatures = Arrays.asList(fileStreamSignature);
Exception e = assertThrows(SignatureVerificationException.class, () -> nodeSignatureVerifier.verify(fileStreamSignatures));
assertTrue(e.getMessage().contains("Signature verification failed for file"));
}
Aggregations