Skip to content

Commit

Permalink
address pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
JesusMcCloud committed Sep 19, 2024
1 parent 605d277 commit e44bc55
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* `ByteArray.decodeAsn1VarUInt()`
* Revamp implicit tagging
* Consume only the first `Asn1Element.parse()` only consumes the first parsable element and
`Asn1Element.parserWithRemainder()` additionally returns the remaining bytes for convenience
`Asn1Element.parseWithRemainder()` additionally returns the remaining bytes for convenience
* More consistent low-level encoding and decoding function names:
* `encodeToAsn1Primitive` to produce an `Asn1Primitive` that can directly be DER-encoded
* `encodeToAsn1ContentBytes` to produce the content bytes of a TLV primitive (the _V_ in TLV)
Expand Down
4 changes: 2 additions & 2 deletions indispensable-cosef/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ signing {
val signingKeyId: String? by project
val signingKey: String? by project
val signingPassword: String? by project
// useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
// sign(publishing.publications)
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications)
}
4 changes: 2 additions & 2 deletions indispensable-josef/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ signing {
val signingKeyId: String? by project
val signingKey: String? by project
val signingPassword: String? by project
// useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
// sign(publishing.publications)
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications)
}
4 changes: 2 additions & 2 deletions indispensable/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,6 @@ signing {
val signingKeyId: String? by project
val signingKey: String? by project
val signingPassword: String? by project
// useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
// sign(publishing.publications)
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications)
}
Original file line number Diff line number Diff line change
Expand Up @@ -235,24 +235,24 @@ fun Asn1Primitive.readNullOrNull() = catching { readNull() }.getOrNull()


/**
* Generic decoding function. Verifies that this [Asn1Primitive]'s tag matches [tag]
* Generic decoding function. Verifies that this [Asn1Primitive]'s tag matches [assertTag]
* and transforms its content as per [transform]
* @throws Asn1Exception all sorts of exceptions on invalid input
*/
@Throws(Asn1Exception::class)
inline fun <reified T> Asn1Primitive.decode(tag: ULong, transform: (content: ByteArray) -> T): T =
decode(Asn1Element.Tag(tag, constructed = false), transform)
inline fun <reified T> Asn1Primitive.decode(assertTag: ULong, transform: (content: ByteArray) -> T): T =
decode(Asn1Element.Tag(assertTag, constructed = false), transform)

/**
* Generic decoding function. Verifies that this [Asn1Primitive]'s tag matches [tag]
* Generic decoding function. Verifies that this [Asn1Primitive]'s tag matches [assertTag]
* and transforms its content as per [transform]
* @throws Asn1Exception all sorts of exceptions on invalid input
*/
@Throws(Asn1Exception::class)
inline fun <reified T> Asn1Primitive.decode(tag: Asn1Element.Tag, transform: (content: ByteArray) -> T) =
inline fun <reified T> Asn1Primitive.decode(assertTag: Asn1Element.Tag, transform: (content: ByteArray) -> T) =
runRethrowing {
if (tag.isConstructed) throw IllegalArgumentException("A primitive cannot have a CONSTRUCTED tag")
if (tag != this.tag) throw Asn1TagMismatchException(tag, this.tag)
if (assertTag.isConstructed) throw IllegalArgumentException("A primitive cannot have a CONSTRUCTED tag")
if (assertTag != this.tag) throw Asn1TagMismatchException(assertTag, this.tag)
transform(content)
}

Expand Down

0 comments on commit e44bc55

Please sign in to comment.