mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-10-04 19:42:01 +08:00
add test: SignatureInfoTest
This commit is contained in:
1 parent
c8f0e35f1b
commit
c45667cc8d
6 files changed
+182
-96
No files matched your search
@@ -212,10 +212,12 @@ public class Data implements IEncodingAble, InteractWithField {
|
||||
if (!this.freshnessPeriod.wireDecode(newblock)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case TLV.TlvPayload:
|
||||
if (!this.payload.wireDecode(newblock)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// TODO: 这边可以规定哪些范围是自定义的,哪些是预留的,然后根据需要这边抛出错误
|
||||
|
||||
|
||||
@@ -258,26 +258,32 @@ public class Interest implements InteractWithField, IEncodingAble {
|
||||
if (!this.canBePrefix.wireDecode(newblock)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case TLV.TlvMustBeRefresh:
|
||||
if (!this.mustBeRefresh.wireDecode(newblock)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case TLV.TlvInterestLifeTime:
|
||||
if (!this.interestLifeTime.wireDecode(newblock)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case TLV.TlvNonce:
|
||||
if (!this.nonce.wireDecode(newblock)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case TLV.TlvHopLimit:
|
||||
if (!this.hopLimit.wireDecode(newblock)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case TLV.TlvPayload:
|
||||
if (!this.payload.wireDecode(newblock)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// TODO: 这边可以规定哪些范围是自定义的,哪些是预留的,然后根据需要这边抛出错误
|
||||
|
||||
|
||||
@@ -147,21 +147,25 @@ public class MINPacket implements IEncodingAble {
|
||||
|
||||
// 标示解析到了至少一个以上的合法标识
|
||||
existIdentifier = true;
|
||||
break;
|
||||
case TLV.TlvSignatureField: // 签名区
|
||||
// 解析签名区,保证如果存在签名,则签名均符合格式
|
||||
if (!this.signatureField.wireDecode(cacheBlock)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case TLV.TlvReadOnlyField: // 只读区
|
||||
// 解析只读区
|
||||
if (!this.readOnlyField.wireDecode(cacheBlock)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case TLV.TlvMutableField: // 可变区
|
||||
// 解析可变区
|
||||
if (!this.mutableField.wireDecode(cacheBlock)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
||||
|
||||
Reference in new issue
Block a user