Skip to content

Instantly share code, notes, and snippets.

@wibisono
Created June 3, 2020 18:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wibisono/b334fd1c561ea79df05f348d350efbb5 to your computer and use it in GitHub Desktop.
Save wibisono/b334fd1c561ea79df05f348d350efbb5 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/amm
//Install ammonite.io and run amm checkmft.scala or if you +x you can run it as script.
import $ivy.`net.ripe.rpki:rpki-commons:1.8.0`
import net.ripe.rpki.commons.crypto.cms.manifest.ManifestCmsParser
import java.nio.file.{Files, Paths}
@main def main(ar: String*){
val args = ar.toArray
if(args.length < 1 || !args(0).endsWith("mft")){
println("Mft file name needed")
System.exit(0)
}
val mftFile = args(0)
val rp = new ManifestCmsParser()
val mft = Files.readAllBytes(Paths.get(mftFile))
rp.parse(mftFile, mft)
val mftcms = rp.getManifestCms
mftcms.getFileNames.forEach(println)
println("Next update time" + mftcms.getNextUpdateTime)
println("Not valid before " + mftcms.getNotValidBefore)
println("Not valid before " + mftcms.getNotValidAfter)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment