-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add withValidityPeriod to MFT and CRL builders #141
Conversation
public DateTime getThisUpdateTime() { | ||
return thisUpdateTime; | ||
} | ||
|
||
public X509CrlBuilder withNextUpdateTime(DateTime instant) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can even deprecate the old ones with annotations since they are a footcannon? Not sure if we ever need to set just one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also curious to think about where we can check that a validityperiod is sane, but that would be hard for any valid object. Maybe in the validation checks in the generic signed object parser?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point,
search says that they are not used separately anywhere
https://github.com/search?q=org%3ARIPE-NCC%20withNextUpdateTime&type=code
So I'll mark them as deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ValidityPeriod does the check that the second date is >= the first one, so it's relatively sane. Can't come up with a good idea what is the use case of notValidBefore.isEqual(notValidAfter)
though.
public void shouldBeEquivalentToSetDateInDifferentWays() { | ||
var builder1 = new ManifestCmsBuilder(); | ||
builder1.withManifestNumber(BigInteger.valueOf(68)); | ||
builder1.withThisUpdateTime(THIS_UPDATE_TIME); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
ManifestCmsBuilder.withThisUpdateTime
var builder1 = new ManifestCmsBuilder(); | ||
builder1.withManifestNumber(BigInteger.valueOf(68)); | ||
builder1.withThisUpdateTime(THIS_UPDATE_TIME); | ||
builder1.withNextUpdateTime(NEXT_UPDATE_TIME); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
ManifestCmsBuilder.withNextUpdateTime
var builder2 = new ManifestCmsBuilder(); | ||
builder2.withManifestNumber(BigInteger.valueOf(68)); | ||
builder2.withValidityPeriod(new ValidityPeriod(THIS_UPDATE_TIME, NEXT_UPDATE_TIME)); | ||
builder2.withNextUpdateTime(NEXT_UPDATE_TIME); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
ManifestCmsBuilder.withNextUpdateTime
public void shouldBeEquivalentToSetDateInDifferentWays() { | ||
var builder1 = new X509CrlBuilder(); | ||
builder1.withIssuerDN(new X500Principal("CN=ROOT")); | ||
builder1.withThisUpdateTime(THIS_UPDATE_TIME); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
X509CrlBuilder.withThisUpdateTime
var builder1 = new X509CrlBuilder(); | ||
builder1.withIssuerDN(new X500Principal("CN=ROOT")); | ||
builder1.withThisUpdateTime(THIS_UPDATE_TIME); | ||
builder1.withNextUpdateTime(NEXT_UPDATE_TIME); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
X509CrlBuilder.withNextUpdateTime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to update the tests to no longer use the deprecated methods (except when explicitly testing these methods) and use withValidityPeriod
.
Yeah, makes sense. |
src/test/java/net/ripe/rpki/commons/crypto/cms/manifest/ManifestCmsBuilderTest.java
Show resolved
Hide resolved
753822b
to
61db747
Compare
Because it's already done and I don't get how GH UI works
This is to avoid mistakes with setting validity dates and getting them backwards (learned the hard way)