-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix recently introduced test smells [a6c591d6] * Update dependency io.freefair.lombok:io.freefair.lombok.gradle.plugin to v8.4 [abf6ba07] * Update dependency gradle to v8.4 [9c081c9e] * Fix the filename of the jsonl log file [de69c5b0] * Use @UtilityClass [4cdea886] * SonarQube feedback [2bcecd21] * Improve style of testcase [2c2417bb] * Base published_at for published objects on (signed) object time [09820351] * This unused class does not spark joy either [a585d9e3] * Remove unused class [3a7e6c0b] * Update dependency commons-io:commons-io to v2.14.0 [bf9f955c] * Update postgres to 15 [1ceaee79] * Update dependency io.freefair.lombok:io.freefair.lombok.gradle.plugin to v8.3 [9ece42a7] * Add counter on progress on All CA Update Service progress [93e80ba3]
- Loading branch information
RPKI Team at RIPE NCC
committed
Oct 19, 2023
1 parent
ee619db
commit 722e933
Showing
20 changed files
with
191 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 5 additions & 6 deletions
11
src/main/java/net/ripe/rpki/domain/TrustAnchorPublishedObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
src/main/java/net/ripe/rpki/ripencc/services/impl/LinkUtil.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package net.ripe.rpki.util; | ||
|
||
import lombok.experimental.UtilityClass; | ||
import lombok.extern.slf4j.Slf4j; | ||
import net.ripe.rpki.commons.crypto.cms.GenericRpkiSignedObjectParser; | ||
import net.ripe.rpki.commons.crypto.crl.X509Crl; | ||
import net.ripe.rpki.commons.crypto.x509cert.X509ResourceCertificateParser; | ||
import net.ripe.rpki.commons.util.RepositoryObjectType; | ||
import net.ripe.rpki.commons.validation.ValidationResult; | ||
import org.joda.time.Instant; | ||
|
||
import java.net.URI; | ||
import java.util.Base64; | ||
|
||
@Slf4j | ||
@UtilityClass | ||
public class PublishedObjectUtil { | ||
|
||
// FIXME: Should be moved into rpki-commons after we use >=1.35 in core because this is a port of code present in commons test-cases and in rsyncit. | ||
public static Instant getFileCreationTime(URI uri, byte[] decoded) { | ||
var objectUri = uri.toString(); | ||
final RepositoryObjectType objectType = RepositoryObjectType.parse(objectUri); | ||
try { | ||
switch (objectType) { | ||
case Manifest: | ||
case Aspa: | ||
case Roa: | ||
case Gbr: | ||
var signedObjectParser = new GenericRpkiSignedObjectParser(); | ||
|
||
signedObjectParser.parse(ValidationResult.withLocation(objectUri), decoded); | ||
return Instant.ofEpochMilli(signedObjectParser.getSigningTime().getMillis()); | ||
case Certificate: | ||
X509ResourceCertificateParser x509CertificateParser = new X509ResourceCertificateParser(); | ||
x509CertificateParser.parse(ValidationResult.withLocation(objectUri), decoded); | ||
final var cert = x509CertificateParser.getCertificate().getCertificate(); | ||
return Instant.ofEpochMilli(cert.getNotBefore().getTime()); | ||
case Crl: | ||
var x509Crl = X509Crl.parseDerEncoded(decoded, ValidationResult.withLocation(objectUri)); | ||
var crl = x509Crl.getCrl(); | ||
return Instant.ofEpochMilli(crl.getThisUpdate().getTime()); | ||
case Unknown: | ||
log.error("Unknown object type for object url = {}"); | ||
return Instant.now(); | ||
} | ||
} catch (Exception e) { | ||
log.error("Could not parse the object url = {}, body = {} :", objectUri, Base64.getEncoder().encodeToString(decoded)); | ||
} | ||
return Instant.now(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.