public static byte [ ] serialize ( Challenge challenge , byte [ ] hmacSecret ) { MiniMessagePack . Packer packer = new MiniMessagePack . Packer ( ) ; packer . pack ( VERSION ) ; packer . pack ( CHALLENGE_MAGIC ) ; packer . pack ( challenge . getUniqueData ( ) ) ; packer . pack ( challenge . getValidFromTimestamp ( ) ) ; packer . pack ( challenge . getValidToTimestamp ( ) ) ; packer . pack ( challenge . getFingerprint ( ) . getBytes ( ) ) ; packer . pack ( challenge . getServerName ( ) ) ; packer . pack ( challenge . getUserName ( ) ) ; byte [ ] bytes = packer . getBytes ( ) ; byte [ ] mac = getAuthenticationCode ( hmacSecret , bytes ) ; packer . pack ( mac ) ; return packer . getBytes ( ) ; }
Serialize a challenge into it s binary representation