cd $::test::dir
set testname [file rootname [file tail $::argv0]]
-start_tests "Тесты на cms -encrypt"
+start_tests "Тесты на cms -encrypt"
proc make_fn {alg} {
return [string map {":" "_"} $alg]
}
}
return $result
}
-
+
if {![file exist encrypt.dat]} {
- makeFile encrypt.dat [string repeat "Test data to encrypt.\n" 100]
+ makeFile encrypt.dat [string repeat "Test data to encrypt.\n" 100]
}
if {![info exist env(NO_RSA)]} {
test -createsfiles cms_enc_rsa.msg "RSA User 1 encrypts message for RSA user 2" {
- openssl "cms -encrypt -in encrypt.dat -des -out cms_enc_rsa.msg U_cms_enc_rsa_2/cert.pem"
+ openssl "cms -encrypt -in encrypt.dat -aes-128-cbc -out cms_enc_rsa.msg U_cms_enc_rsa_2/cert.pem"
file isfile cms_enc_rsa.msg
} 0 1
if {![file exists $username/req.pem]&&[file exists $username/cert.pem]} {
file delete $username/cert.pem
- }
+ }
file exists $username/cert.pem
} 0 1
test -createsfiles cms_decrypt.$alg_fn "Decrypting file encrypted for $username" {
set expected [getFile encrypt.dat]
- openssl "cms -decrypt -in cms_enc_$alg_fn.msg -recip U_cms_enc_$alg_fn/cert.pem -inkey U_cms_enc_$alg_fn/seckey.pem -out cms_decrypt.$alg_fn"
+ openssl "cms -decrypt -debug_decrypt -in cms_enc_$alg_fn.msg -recip U_cms_enc_$alg_fn/cert.pem -inkey U_cms_enc_$alg_fn/seckey.pem -out cms_decrypt.$alg_fn"
set result [getFile cms_decrypt.$alg_fn]
string eq $expected $result
} 0 1
test -createsfiles cms_decrypt_t.$alg_fn "Decrypting file text-encrypted for $username" {
set expected [getFile encrypt.dat]
- openssl "cms -decrypt -text -in cms_enc_t_$alg_fn.msg -recip U_cms_enc_$alg_fn/cert.pem -inkey U_cms_enc_$alg_fn/seckey.pem -out cms_decrypt_t.$alg_fn"
+ openssl "cms -decrypt -debug_decrypt -text -in cms_enc_t_$alg_fn.msg -recip U_cms_enc_$alg_fn/cert.pem -inkey U_cms_enc_$alg_fn/seckey.pem -out cms_decrypt_t.$alg_fn"
set result [getFile cms_decrypt_t.$alg_fn]
string eq $expected $result
} 0 1
test -createsfiles cms_decrypt_t_nocert.$alg_fn "Decrypting file text-encrypted for $username without cert" {
set expected [getFile encrypt.dat]
- openssl "cms -decrypt -text -in cms_enc_t_$alg_fn.msg -inkey U_cms_enc_$alg_fn/seckey.pem -out cms_decrypt_t_nocert.$alg_fn"
+ openssl "cms -decrypt -debug_decrypt -text -in cms_enc_t_$alg_fn.msg -inkey U_cms_enc_$alg_fn/seckey.pem -out cms_decrypt_t_nocert.$alg_fn"
set result [getFile cms_decrypt_t_nocert.$alg_fn]
string eq $expected $result
} 0 1
}
set alg_fn [make_fn $enc_tuple]
set username U_cms_enc_$alg_fn
-
+
test -skip {![file exists cms_enc_4all.msg]} -createsfiles cms_decrypt_4all.$alg_fn "Decrypting gost-encrypted file, recipient $alg_fn" {
set expected [getFile encrypt.dat]
openssl "cms -decrypt -in cms_enc_4all.msg -recip $username/cert.pem -inkey $username/seckey.pem -out cms_decrypt_4all.$alg_fn"
test -skip {![file exists cms_enc_4all.msg]} -createsfiles cms_decrypt_4all_nocert.$alg_fn "Decrypting gost-encrypted file without cert, recipient $alg_fn" {
set expected [getFile encrypt.dat]
- openssl "cms -decrypt -in cms_enc_4all.msg -inkey $username/seckey.pem -out cms_decrypt_4all_nocert.$alg_fn"
+ openssl "cms -decrypt -debug_decrypt -in cms_enc_4all.msg -inkey $username/seckey.pem -out cms_decrypt_4all_nocert.$alg_fn"
set result [getFile cms_decrypt_4all_nocert.$alg_fn]
string eq $expected $result
} 0 1