Search in sources :

Example 1 with FileCertificateRepo

use of org.apache.cxf.xkms.x509.repo.file.FileCertificateRepo in project cxf by apache.

the class TrustedAuthorityValidatorTest method setUpCertificateRepo.

@Before
public void setUpCertificateRepo() throws CertificateException {
    File storageDir = new File("target/teststore_trusted_authority_validator");
    FileUtils.removeDir(storageDir);
    storageDir.mkdirs();
    certificateRepo = new FileCertificateRepo("target/teststore_trusted_authority_validator");
    UseKeyWithType rootKey = new UseKeyWithType();
    rootKey.setApplication(Applications.PKIX.getUri());
    String subjectDN = certificateRoot.getSubjectX500Principal().getName();
    rootKey.setIdentifier(subjectDN);
    certificateRepo.saveTrustedCACertificate(certificateRoot, rootKey);
    UseKeyWithType aliceKey = new UseKeyWithType();
    aliceKey.setApplication(Applications.PKIX.getUri());
    subjectDN = certificateAlice.getSubjectX500Principal().getName();
    aliceKey.setIdentifier(subjectDN);
    certificateRepo.saveCACertificate(certificateAlice, aliceKey);
}
Also used : UseKeyWithType(org.apache.cxf.xkms.model.xkms.UseKeyWithType) File(java.io.File) FileCertificateRepo(org.apache.cxf.xkms.x509.repo.file.FileCertificateRepo) Before(org.junit.Before)

Example 2 with FileCertificateRepo

use of org.apache.cxf.xkms.x509.repo.file.FileCertificateRepo in project cxf by apache.

the class TrustedAuthorityValidatorCRLTest method setUpCertificateRepo.

@Before
public void setUpCertificateRepo() throws CertificateException {
    File storageDir = new File("target/teststore_trusted_authority_validator");
    FileUtils.removeDir(storageDir);
    storageDir.mkdirs();
    certificateRepo = new FileCertificateRepo("target/teststore_trusted_authority_validator");
    UseKeyWithType rootKey = new UseKeyWithType();
    rootKey.setApplication(Applications.PKIX.getUri());
    String subjectDN = certificateRoot.getSubjectX500Principal().getName();
    rootKey.setIdentifier(subjectDN);
    certificateRepo.saveTrustedCACertificate(certificateRoot, rootKey);
    UseKeyWithType aliceKey = new UseKeyWithType();
    aliceKey.setApplication(Applications.PKIX.getUri());
    subjectDN = certificateWss40Rev.getSubjectX500Principal().getName();
    aliceKey.setIdentifier(subjectDN);
    certificateRepo.saveCACertificate(certificateWss40Rev, aliceKey);
    UseKeyWithType bobKey = new UseKeyWithType();
    bobKey.setApplication(Applications.PKIX.getUri());
    subjectDN = certificateWss40.getSubjectX500Principal().getName();
    bobKey.setIdentifier(subjectDN);
    certificateRepo.saveCACertificate(certificateWss40, bobKey);
    UseKeyWithType crlKey = new UseKeyWithType();
    crlKey.setApplication(Applications.PKIX.getUri());
    crlKey.setIdentifier(crl.getIssuerX500Principal().getName());
    certificateRepo.saveCRL(crl, crlKey);
}
Also used : UseKeyWithType(org.apache.cxf.xkms.model.xkms.UseKeyWithType) File(java.io.File) FileCertificateRepo(org.apache.cxf.xkms.x509.repo.file.FileCertificateRepo) Before(org.junit.Before)

Aggregations

File (java.io.File)2 UseKeyWithType (org.apache.cxf.xkms.model.xkms.UseKeyWithType)2 FileCertificateRepo (org.apache.cxf.xkms.x509.repo.file.FileCertificateRepo)2 Before (org.junit.Before)2