55 lines
2.4 KiB
Plaintext
55 lines
2.4 KiB
Plaintext
|
1. Preparing data in this directory
|
||
|
|
||
|
mkdir tmp
|
||
|
cd tmp
|
||
|
keytool -keystore ks -genkeypair -storepass changeit -alias a -dname CN=A
|
||
|
openssl pkcs12 -in ks -nodes -out kandc -passin pass:changeit
|
||
|
openssl pkcs12 -export -in kandc -out os2 -name a -passout pass:changeit \
|
||
|
-certpbe NONE -nomac
|
||
|
openssl pkcs12 -export -in kandc -out os3 -name a -passout pass:changeit \
|
||
|
-certpbe NONE
|
||
|
openssl pkcs12 -export -in kandc -out os4 -name a -passout pass:changeit \
|
||
|
-certpbe PBE-SHA1-RC4-128 -keypbe PBE-SHA1-RC4-128 -macalg SHA224
|
||
|
openssl pkcs12 -export -in kandc -out os5 -name a -passout pass:changeit \
|
||
|
-certpbe AES-256-CBC -keypbe AES-256-CBC -macalg SHA512
|
||
|
for a in *; do
|
||
|
openssl base64 -in $a -out ../$a
|
||
|
done
|
||
|
cd ..
|
||
|
rm -rf tmp
|
||
|
|
||
|
2. After running the test, we can go to the scratch directory and run the
|
||
|
following commands to check keytool -> openssl interoperability.
|
||
|
OpenSSL 1.1.0i is used here. Earlier versions might generate different info.
|
||
|
|
||
|
(
|
||
|
openssl pkcs12 -in ks2 -passin pass:changeit -info -nokeys -nocerts 2> t2 || exit 20
|
||
|
grep "MAC:sha1 Iteration 100000" t2 || exit 21
|
||
|
grep "Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 50000" t2 || exit 23
|
||
|
grep "PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 50000" t2 || exit 24
|
||
|
|
||
|
openssl pkcs12 -in ks22 -passin pass:changeit -info -nokeys -nocerts 2> t22 || exit 25
|
||
|
diff t2 t22 || exit 26
|
||
|
|
||
|
openssl pkcs12 -in ks3 -passin pass:changeit -info -nokeys -nocerts && exit 30
|
||
|
|
||
|
openssl pkcs12 -in ks3 -passin pass:changeit -info -nokeys -nocerts -nomacver 2> t3 || exit 31
|
||
|
grep "PKCS7 Encrypted data:" t3 && exit 33
|
||
|
grep "Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 50000" t3 || exit 34
|
||
|
grep "Shrouded Keybag: pbeWithSHA1And128BitRC4, Iteration 50000" t3 || exit 35
|
||
|
|
||
|
openssl pkcs12 -in ks33 -passin pass:changeit -info -nokeys -nocerts -nomacver 2> t33 || exit 36
|
||
|
diff t3 t33 || exit 37
|
||
|
|
||
|
openssl pkcs12 -in ks4 -passin pass:changeit -info -nokeys -nocerts 2> t4 || exit 40
|
||
|
grep "MAC:sha1 Iteration 5555" t4 || exit 41
|
||
|
grep "Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 7777" t4 || exit 43
|
||
|
grep "Shrouded Keybag: pbeWithSHA1And128BitRC4, Iteration 50000" t4 || exit 44
|
||
|
grep "PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 6666" t4 || exit 45
|
||
|
|
||
|
openssl pkcs12 -in ks44 -passin pass:changeit -info -nokeys -nocerts 2> t44 || exit 46
|
||
|
diff t4 t44 || exit 47
|
||
|
|
||
|
echo Succeed
|
||
|
)
|