decryption test after keygen

This commit is contained in:
NIIBE Yutaka
2012-06-28 12:01:37 +09:00
parent 3202b7d45c
commit 2764bbb5a9
4 changed files with 39 additions and 3 deletions

View File

@@ -0,0 +1,19 @@
@keygen
Feature: decryption
In order to use a token
A token should decrypt encrypted data
Scenario: decrypt by OPENPGP.2 key (1)
Given a plain text "This is a test message."
And a public key from token for OPENPGP.2
And encrypt it on host
And let a token decrypt encrypted data
Then decrypted data should be same as a plain text
Scenario: decrypt by OPENPGP.2 key (2)
Given a plain text "RSA decryption is as easy as pie."
And a public key from token for OPENPGP.2
And encrypt it on host
And let a token decrypt encrypted data
Then decrypted data should be same as a plain text

View File

@@ -95,11 +95,15 @@ def compute_signature_on_host(keyno_str):
def set_plaintext(content_str_repr):
scc.plaintext = ast.literal_eval(content_str_repr)
@Given("encrypt it on host with RSA key pair (.*)")
@Given("encrypt it on host with RSA key pair (.*)$")
def encrypt_on_host(keyno_str):
keyno = int(keyno_str)
scc.ciphertext = rsa_keys.encrypt(keyno, scc.plaintext)
@Given("encrypt it on host$")
def encrypt_on_host_public_key():
scc.ciphertext = rsa_keys.encrypt_with_pubkey(scc.pubkey_info, scc.plaintext)
@Given("let a token decrypt encrypted data")
def decrypt():
scc.result = ftc.token.cmd_pso_longdata(0x80, 0x86, scc.ciphertext)