mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-20 21:43:18 +00:00
Updated a couple of files to resolve aca load issues
This commit is contained in:
parent
b7357fac9b
commit
6b063d44e0
@ -1,6 +1,10 @@
|
||||
package hirs.attestationca.persist;
|
||||
|
||||
import hirs.structs.converters.SimpleStructConverter;
|
||||
import hirs.structs.converters.StructConverter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
||||
/**
|
||||
* Persistence Configuration for Spring enabled applications. Constructs a Hibernate SessionFactory
|
||||
@ -12,6 +16,18 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration
|
||||
public class PersistenceConfiguration {
|
||||
|
||||
/**
|
||||
* Prototyped {@link StructConverter}. In other words, all instances
|
||||
* returned by this method will be configured identically, but subsequent
|
||||
* invocations will return a new instance.
|
||||
*
|
||||
* @return ready to use {@link StructConverter}.
|
||||
*/
|
||||
@Bean
|
||||
@Scope("prototype")
|
||||
public static StructConverter structConverter() {
|
||||
return new SimpleStructConverter();
|
||||
}
|
||||
// @Bean
|
||||
// public FilesStorageService filesStorageService() {
|
||||
// FilesStorageServiceImpl filesStorageService = new FilesStorageServiceImpl(new StorageProperties());
|
||||
|
@ -21,6 +21,7 @@ import org.hibernate.annotations.JdbcTypeCode;
|
||||
import javax.xml.XMLConstants;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Base64;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -104,6 +105,9 @@ public class ReferenceManifest extends ArchivableEntity {
|
||||
private String hexDecHash = "";
|
||||
@Column
|
||||
private String eventLogHash = "";
|
||||
@Column
|
||||
@JsonIgnore
|
||||
private String base64Hash = "";
|
||||
|
||||
/**
|
||||
* Default constructor necessary for Hibernate.
|
||||
@ -141,6 +145,14 @@ public class ReferenceManifest extends ArchivableEntity {
|
||||
} catch (NoSuchAlgorithmException noSaEx) {
|
||||
log.error(noSaEx);
|
||||
}
|
||||
this.base64Hash = "";
|
||||
try {
|
||||
digest = MessageDigest.getInstance("SHA-256");
|
||||
this.base64Hash = Base64.getEncoder().encodeToString(
|
||||
digest.digest(rimBytes));
|
||||
} catch (NoSuchAlgorithmException noSaEx) {
|
||||
log.error(noSaEx);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,5 @@
|
||||
package hirs.attestationca.persist.entity.userdefined.rim;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import hirs.attestationca.persist.entity.userdefined.ReferenceManifest;
|
||||
import hirs.utils.SwidResource;
|
||||
import hirs.utils.swid.SwidTagConstants;
|
||||
@ -32,10 +31,7 @@ import javax.xml.validation.SchemaFactory;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -54,9 +50,6 @@ public class BaseReferenceManifest extends ReferenceManifest {
|
||||
|
||||
private static JAXBContext jaxbContext;
|
||||
|
||||
@Column
|
||||
@JsonIgnore
|
||||
private String base64Hash = "";
|
||||
@Column
|
||||
private String swidName = null;
|
||||
@Column
|
||||
@ -120,16 +113,6 @@ public class BaseReferenceManifest extends ReferenceManifest {
|
||||
Element entity;
|
||||
Element link;
|
||||
|
||||
MessageDigest digest = null;
|
||||
this.base64Hash = "";
|
||||
try {
|
||||
digest = MessageDigest.getInstance("SHA-256");
|
||||
this.base64Hash = Base64.getEncoder().encodeToString(
|
||||
digest.digest(rimBytes));
|
||||
} catch (NoSuchAlgorithmException noSaEx) {
|
||||
log.error(noSaEx);
|
||||
}
|
||||
|
||||
// begin parsing valid swid tag
|
||||
if (document != null) {
|
||||
softwareIdentity = (Element) document.getElementsByTagName(SwidTagConstants.SOFTWARE_IDENTITY).item(0);
|
||||
|
@ -1,7 +1,5 @@
|
||||
package hirs.attestationca.portal;
|
||||
|
||||
import hirs.attestationca.persist.service.SupplyChainValidationService;
|
||||
import hirs.attestationca.persist.service.SupplyChainValidationServiceImpl;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
@ -28,7 +26,6 @@ import org.springframework.web.servlet.config.annotation.DefaultServletHandlerCo
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
//import javax.sql.DataSource;
|
||||
import javax.sql.DataSource;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@ -90,11 +87,6 @@ public class PersistenceJPAConfig implements WebMvcConfigurer {
|
||||
return entityManagerBean;
|
||||
}
|
||||
|
||||
// @Bean
|
||||
// public SupplyChainValidationService supplyChainValidationService() {
|
||||
// return new SupplyChainValidationServiceImpl();
|
||||
// }
|
||||
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
||||
|
Loading…
Reference in New Issue
Block a user