@Test public void shouldRoundTripBuildParseRpkiCaCertRequest() throws RpkiCaCertificateRequestParserException { RpkiCaCertificateRequestBuilder requestBuilder = new RpkiCaCertificateRequestBuilder(); URI caRepositoryUri = URI.create("rsync://host/module/subdir/"); URI manifestUri = URI.create("rsync://host/module/subdir/subject.mft"); X500Principal subject = new X500Principal("CN=subject"); KeyPair keyPair = PregeneratedKeyPairFactory.getInstance().generate(); requestBuilder.withCaRepositoryUri(caRepositoryUri); requestBuilder.withManifestUri(manifestUri); requestBuilder.withSubject(subject); PKCS10CertificationRequest pkcs10Request = requestBuilder.build(keyPair); assertNotNull(pkcs10Request); RpkiCaCertificateRequestParser requestParser = new RpkiCaCertificateRequestParser(pkcs10Request); assertEquals(caRepositoryUri, requestParser.getCaRepositoryUri()); assertEquals(manifestUri, requestParser.getManifestUri()); assertEquals(keyPair.getPublic(), requestParser.getPublicKey()); }
public static PKCS10CertificationRequest createRpkiCaCertificateRequest() { RpkiCaCertificateRequestBuilder requestBuilder = new RpkiCaCertificateRequestBuilder(); requestBuilder.withCaRepositoryUri(ProvisioningObjectMother.RPKI_CA_CERT_REQUEST_CA_REPO_URI); requestBuilder.withManifestUri(ProvisioningObjectMother.RPKI_CA_CERT_REQUEST_CA_MFT_URI); requestBuilder.withNotificationUri( ProvisioningObjectMother.RPKI_CA_CERT_REQUEST_CA_NOTIFICATION_URI); requestBuilder.withSubject(ProvisioningObjectMother.RPKI_CA_CERT_REQUEST_CA_SUBJECT); PKCS10CertificationRequest pkcs10Request = requestBuilder.build(ProvisioningObjectMother.RPKI_CA_CERT_REQUEST_KEYPAIR); return pkcs10Request; }