use of de.trustable.ca3s.core.domain.CertificateAttribute in project ca3sCore by kuehne-trustable-de.
the class CertificateUtilIntTest method testBuildCertificateWithSAN2.
@Test
public void testBuildCertificateWithSAN2() throws GeneralSecurityException, IOException {
String executionId = "";
Certificate cert = certificateUtil.createCertificate(testCertWithSAN2, null, executionId);
assertNotNull(cert);
assertFalse(cert.getSans().isEmpty());
assertEquals("info@ramthun.net", cert.getSans());
boolean sanPresent = false;
for (CertificateAttribute certAtt : cert.getCertificateAttributes()) {
if (CertificateAttribute.ATTRIBUTE_SAN.equals(certAtt.getName())) {
// assertEquals("ca@trustable.de", certAtt.getValue());
System.out.println("::: " + certAtt.getValue());
sanPresent = true;
}
}
assertTrue(sanPresent);
}
use of de.trustable.ca3s.core.domain.CertificateAttribute in project ca3sCore by kuehne-trustable-de.
the class CertificateUtilIntTest method testBuildCertificatetestCertWithLongSAN.
@Test
public void testBuildCertificatetestCertWithLongSAN() throws GeneralSecurityException, IOException {
String executionId = "";
Certificate cert = certificateUtil.createCertificate(testCertWithLongSAN, null, executionId);
assertNotNull(cert);
assertFalse(cert.getSans().isEmpty());
assertEquals("2.16.724.1.3.5.1.2.1=sede electrónica,2.16.724.1.3.5.1.2.2=ministerio de industria energia y turismo,2.16.724.1.3.5.1.2.3=s2800214e,2.16.724.1.3.5.1.2.4=sede electronica del ministerio de industria energia y turismo,2.16.724.1.3.5.1.2.5=sede.minetur.", cert.getSans());
int sanCount = 0;
for (CertificateAttribute certAtt : cert.getCertificateAttributes()) {
if (CertificateAttribute.ATTRIBUTE_SAN.equals(certAtt.getName())) {
sanCount++;
}
if (CertificateAttribute.ATTRIBUTE_CRL_URL.equals(certAtt.getName())) {
System.out.println("ATTRIBUTE_CRL_URL" + certAtt.getValue());
}
}
assertEquals(2, sanCount);
assertEquals("rsa", cert.getKeyAlgorithm());
assertEquals("rsa", cert.getSigningAlgorithm());
assertEquals("sha1", cert.getHashingAlgorithm());
assertEquals("2048", cert.getKeyLength().toString());
assertEquals("pkcs1", cert.getPaddingAlgorithm());
}
use of de.trustable.ca3s.core.domain.CertificateAttribute in project ca3sCore by kuehne-trustable-de.
the class CertificateUtilIntTest method testBuildCertificatestLocalhost.
@Test
public void testBuildCertificatestLocalhost() throws GeneralSecurityException, IOException {
String executionId = "";
Certificate cert = certificateUtil.createCertificate(testLocalhost, null, executionId);
assertNotNull(cert);
for (CertificateAttribute certAtt : cert.getCertificateAttributes()) {
if (CertificateAttribute.ATTRIBUTE_CRL_URL.equals(certAtt.getName())) {
System.out.println("ATTRIBUTE_CRL_URL" + certAtt.getValue());
}
}
assertEquals("rsa", cert.getKeyAlgorithm());
assertEquals("rsa", cert.getSigningAlgorithm());
assertEquals("sha256", cert.getHashingAlgorithm());
assertEquals("2048", cert.getKeyLength().toString());
assertEquals("pkcs1", cert.getPaddingAlgorithm());
}
use of de.trustable.ca3s.core.domain.CertificateAttribute in project ca3sCore by kuehne-trustable-de.
the class CertificateAttributeResourceIT method createCertificateAttribute.
@Test
@Transactional
public void createCertificateAttribute() throws Exception {
int databaseSizeBeforeCreate = certificateAttributeRepository.findAll().size();
// Create the CertificateAttribute
restCertificateAttributeMockMvc.perform(post("/api/certificate-attributes").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(certificateAttribute))).andExpect(status().isCreated());
// Validate the CertificateAttribute in the database
List<CertificateAttribute> certificateAttributeList = certificateAttributeRepository.findAll();
assertThat(certificateAttributeList).hasSize(databaseSizeBeforeCreate + 1);
CertificateAttribute testCertificateAttribute = certificateAttributeList.get(certificateAttributeList.size() - 1);
assertThat(testCertificateAttribute.getName()).isEqualTo(DEFAULT_NAME);
assertThat(testCertificateAttribute.getValue()).isEqualTo(DEFAULT_VALUE);
}
use of de.trustable.ca3s.core.domain.CertificateAttribute in project ca3sCore by kuehne-trustable-de.
the class CertificateAttributeResource method updateCertificateAttribute.
/**
* {@code PUT /certificate-attributes} : Updates an existing certificateAttribute.
*
* @param certificateAttribute the certificateAttribute to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated certificateAttribute,
* or with status {@code 400 (Bad Request)} if the certificateAttribute is not valid,
* or with status {@code 500 (Internal Server Error)} if the certificateAttribute couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PutMapping("/certificate-attributes")
public ResponseEntity<CertificateAttribute> updateCertificateAttribute(@Valid @RequestBody CertificateAttribute certificateAttribute) throws URISyntaxException {
log.debug("REST request to update CertificateAttribute : {}", certificateAttribute);
if (certificateAttribute.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
CertificateAttribute result = certificateAttributeRepository.save(certificateAttribute);
return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, certificateAttribute.getId().toString())).body(result);
}
Aggregations