Skip to content

Commit

Permalink
add example for more abstract coko rules (#844)
Browse files Browse the repository at this point in the history
Co-authored-by: Selina Lin <[email protected]>
  • Loading branch information
fwendland and seelchen authored Apr 15, 2024
1 parent b6536f7 commit ad301db
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
interface BlockCiper {
fun algorithm(algo: Any): Op
fun blockLength(length: Any): Op
fun mode(mode: Any): Op
fun padding(pad: Any): Op
}


// TODO: need evaluator with condition so we can check if algorithm is AES
@Rule(description = "Check the block length of AES")
fun `correct AES block length`(blockCiper: BlockCiper) =
only(blockCiper.blockLength(listOf(128, 192, 256)))

@Rule(description = "Check the operation mode of ")
fun `correct mode`(blockCiper: BlockCiper) =
only(blockCiper.mode(listOf("CCM", "GCM", "CBC", "CTR")))
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@file:Import("BlockCipher.codyze.kts")

class Cipher {

}

class BouncyCastleBlockCipher: BlockCipher_codyze.BlockCiper {
override fun algorithm(algo: Any): Op {
TODO("Not yet implemented")
}

override fun blockLength(length: Any): Op {
TODO("Not yet implemented")
}

override fun mode(mode: Any): Op {
TODO("Not yet implemented")
}

override fun padding(pad: Any): Op {
TODO("Not yet implemented")
}

}

0 comments on commit ad301db

Please sign in to comment.