Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
Fix tests by fixing helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Cach30verfl0w committed Jun 14, 2024
1 parent 496330c commit 8a95ba4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class KeyStoreFactory<C: Any>(val name: String) {
*/
fun createKeyStore(): KeyStore = object: KeyStore {
private val context = initialize()

override fun readKeyFromFile(path: Path, algorithm: String, purposes: UByte): Key =
readKeyFromFile!!.invoke(context, path, algorithm, purposes)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ object KeyReaderHelper {
*/
fun tryParse(array: ByteArray, purposes: UByte, algorithm: String? = null): Key? = array.usePinned {
val parsedKey = tryParse(it.addressOf(0), array.size.toULong(), purposes)?: return null
if (parsedKey.algorithm != algorithm)
if (algorithm != null && parsedKey.algorithm != algorithm)
throw IllegalArgumentException("The algorithm '$algorithm' was specified, but key is '${parsedKey.algorithm}'")
return parsedKey
}
Expand Down

0 comments on commit 8a95ba4

Please sign in to comment.