Skip to content

Commit

Permalink
Added last-received Voucher function to Pledge, and printout of this …
Browse files Browse the repository at this point in the history
…voucher in the IETF draft-constrained-brski test.
  • Loading branch information
EskoDijk committed Dec 7, 2022
1 parent 5665367 commit 0d12bcb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/com/google/openthread/pledge/Pledge.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public Voucher requestVoucher(VoucherRequest req)
if (payload == null) {
throw new PledgeException("unexpected null payload");
}
this.lastVoucherCoseSigned = payload;

// 2. Receive voucher signed by MASA CA
try {
Expand Down Expand Up @@ -589,6 +590,10 @@ public byte[] getLastPvrCoseSigned() {
return this.lastPvrCoseSigned;
}

public byte[] getLastVoucherCoseSigned() {
return this.lastVoucherCoseSigned;
}

private void init(Credentials creds, String hostURI, boolean isLightweightClientCerts)
throws PledgeException {

Expand Down Expand Up @@ -785,6 +790,7 @@ private String getBRSKIPath() {

private VoucherRequest lastPvr = null;
private byte[] lastPvrCoseSigned = null;
private byte[] lastVoucherCoseSigned = null;

private static Logger logger = LoggerFactory.getLogger(Pledge.class);
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ public void testVoucherRequestAndDisplayArtifacts() throws Exception {
logger.info("Registrar Voucher Request (RVR) sent by Registrar:\n" + registrar.getLastRvr().toString());
logger.info("Registrar Voucher Request (RVR) sent by Registrar as Hex string:\n" + Hex.toHexString(registrar.getLastRvrCoseSigned()));

logger.info("Voucher created by MASA:\n" + voucher);
logger.info("Voucher created by MASA as Hex string:\n" + Hex.toHexString(pledge.getLastVoucherCoseSigned()));

}

Expand Down

0 comments on commit 0d12bcb

Please sign in to comment.