I use Java keytool and I want to do something simple but have a problem after fifth step. What's wrong here?
Side "A" creates public and private key:
keytool -genkeypair -alias AStore -keyalg RSA -keysize 2048 -sigalg SHA256withRSA -dname -keypass Aaa123 -validity 90 -storetype JCEKS -keystore D:\keystore\A\keystore.jceks -storepass Aaa123
Side "B" creates public and private key:
keytool -genkeypair -alias BStore -keyalg RSA -keysize 2048 -sigalg SHA256withRSA -dname -keypass Bbb123 -validity 90 -storetype JCEKS -keystore D:\keystore\B\keystore.jceks -storepass Bbb123
Side "A" export his certificate:
keytool -exportcert -alias AStore -file D:\keystore\A.cer -keystore D:\keystore\A\keystore.jceks -storetype JCEKS
Side "B" export his certificate:
keytool -exportcert -alias BStore -file D:\keystore\B.cer -keystore D:\keystore\B\keystore.jceks -storetype JCEKS
Side "A" import certificate of side "B":
keytool -importcert -alias AStore -file D:\keystore\B.cer -keystore D:\keystore\A\keystore.jceks -storetype JCEKS
I get error:
> keytool error: java.lang.Exception: Public keys in reply and keystore don't match