Skip to content

Commit

Permalink
update BC version, use no padding on identifiers in cert
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellblazer committed May 4, 2024
1 parent cdb561a commit c10a491
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ private void checkpointCompletion(int threshold, Initial mostRecent) {
store.put(checkpointView);
assert !checkpointView.height()
.equals(Unsigned.ulong(0)) : "Should not attempt when bootstrapping from genesis";
var diadem = HexBloom.from(checkpoint.block.getCheckpoint().getCrown());
var crown = HexBloom.from(checkpoint.block.getCheckpoint().getCrown());
log.info("Assembling from checkpoint: {}:{} crown: {} last cp: {} on: {}", checkpoint.height(), checkpoint.hash,
diadem.compactWrapped(), Digest.from(checkpoint.block.getHeader().getLastCheckpointHash()),
crown.compactWrapped(), Digest.from(checkpoint.block.getHeader().getLastCheckpointHash()),
params.member().getId());

CheckpointAssembler assembler = new CheckpointAssembler(params.gossipDuration(), checkpoint.height(),
Expand All @@ -130,10 +130,10 @@ private void checkpointCompletion(int threshold, Initial mostRecent) {

// assemble the checkpoint
checkpointAssembled = assembler.assemble(scheduler, params.gossipDuration()).whenComplete((cps, t) -> {
if (!cps.validate(diadem, Digest.from(checkpoint.block.getHeader().getLastCheckpointHash()))) {
if (!cps.validate(crown, Digest.from(checkpoint.block.getHeader().getLastCheckpointHash()))) {
throw new IllegalStateException("Cannot validate checkpoint: " + checkpoint.height());
}
log.info("Restored checkpoint: {} diadem: {} on: {}", checkpoint.height(), diadem.compactWrapped(),
log.info("Restored checkpoint: {} diadem: {} on: {}", checkpoint.height(), crown.compactWrapped(),
params.member().getId());
checkpointState = cps;
});
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<dropwizard.version>4.0.5</dropwizard.version>
<h2.version>2.2.220</h2.version>
<jooq.version>3.17.2</jooq.version>
<bc.version>1.74</bc.version>
<bc.version>1.78</bc.version>
<logback.version>1.4.12</logback.version>
<grpc.version>1.62.2</grpc.version>
<protobuf.version>3.25.3</protobuf.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,13 +548,14 @@ public CertificateWithPrivateKey provision(Instant validFrom, Duration valid, Li

var signature = signer.sign(qb64(new BasicIdentifier(keyPair.getPublic())));

var dn = new BcX500NameDnImpl(String.format("UID=%s, DC=%s", Base64.getUrlEncoder()
.encodeToString(
(getState().getIdentifier()
.toIdent()
.toByteArray())),
Base64.getUrlEncoder()
.encodeToString(signature.toSig().toByteArray())));
var formatted = String.format("UID=%s, DC=%s", Base64.getUrlEncoder()
.withoutPadding()
.encodeToString(
(getState().getIdentifier().toIdent().toByteArray())),
Base64.getUrlEncoder()
.withoutPadding()
.encodeToString(signature.toSig().toByteArray()));
var dn = new BcX500NameDnImpl(formatted);

return new CertificateWithPrivateKey(
Certificates.selfSign(false, dn, keyPair, validFrom, validFrom.plus(valid), extensions),
Expand Down

0 comments on commit c10a491

Please sign in to comment.