The known-plaintext attack ( KPA ) is an attack model for cryptanalysis where the attacker has samples of both the plaintext and its encrypted version ( known as ciphertext version ) then he can use them to expose further secret information after calculating the secret key . The known-plaintext attack ( KPA ) is an attack model for cryptanalysis where the attacker has samples of both the plaintext , a crib , and its encrypted version ( ciphertext ) . These can be used to reveal further secret information such as secret keys and code books .