- Ошибка Java Keytool после импорта сертификата, «ошибка keytool: java.io.FileNotFoundException & Access Denied»
- ОТВЕТЫ
- Ответ 1
- Ответ 2
- Ответ 3
- Ответ 4
- Ответ 5
- Ответ 6
- Ответ 7
- Ответ 8
- Ответ 9
- Ответ 10
- Ответ 11
- Ответ 12
- Java Keytool error after importing certificate , «keytool error: java.io.FileNotFoundException & Access Denied»
- Java Solutions
- Solution 1 — Java
- Solution 2 — Java
- Solution 3 — Java
- Solution 4 — Java
- Solution 5 — Java
- Solution 6 — Java
- Solution 7 — Java
- Solution 8 — Java
- Solution 9 — Java
- Solution 10 — Java
- Solution 11 — Java
- Solution 12 — Java
- DiaryFolio
- Labels
- Popular posts from this blog
- Create your own Passport Photo using GIMP
- Syslog Standards: A simple Comparison between RFC3164 & RFC5424
Ошибка Java Keytool после импорта сертификата, «ошибка keytool: java.io.FileNotFoundException & Access Denied»
Я пытаюсь подключить Java Web API через HTTPS; однако выбрано исключение:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException
Я выполнил следующие шаги, которые я узнал из онлайн-руководств keytool и SSL cert:
- Я скопировал URL HTTPS в браузер, загрузил SSL-сертификаты и установил их в браузере с помощью Internet Explorer.
- Экспорт сертификатов в путь на моем компьютере, сертификаты были сохранены как .cer
- Используется опция импорта keytool. Приведенная ниже команда выполняется без ошибок.
keytool -import -alias downloadedCertAlias -keystore C:\path\to\my\keystore\cacerts.file -file C:\path\of\exportedCert.cer
keytool error: java.io.FileNotFoundException: C:\Program files\. \cacerts
Наконец, когда я проверил хранилище ключей, сертификат SSL не был добавлен, и мое приложение дает то же исключение, которое я получал раньше при попытке подключения:
(javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException)
ОТВЕТЫ
Ответ 1
Это может произойти, если вы не запускаете командную строку в режиме администратора. Если вы используете Windows 7, вы можете запустить, введите cmd и нажмите Ctrl + Shift + enter. Это откроет командную строку в режиме администратора. Если нет, вы также можете перейти к запуску → все программы → аксессуары → щелкнуть правой кнопкой мыши командную строку и щелкнуть «Запуск от имени администратора».
Ответ 2
У меня была такая же проблема в Windows, и я смог ее решить, запустив cmd.exe в качестве администратора (щелкните правой кнопкой мыши в меню «Пуск», затем «Запуск от имени администратора» ).
Ответ 3
У меня была та же проблема при импорте сертификата в локальное хранилище ключей. Всякий раз, когда я выдаю команду keytool, я получил следующую ошибку.
Сертификат был добавлен в хранилище ключей keytool error: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.8.0_151\jre\lib\security (доступ запрещен)
Следующее решение работает для меня.
1) убедитесь, что вы запускаете командную строку на Rus в режиме администратора
2) Измените текущий каталог на% JAVA_HOME%\jre\lib\security
3), затем выполните команду ниже
keytool -import -alias «mycertificatedemo» файл «C:\Users\name\Downloads\abc.crt» -keystore cacerts
5) вы увидите следующее сообщение об успешном «Сертификат был добавлен в хранилище ключей»
Убедитесь, что вы указываете » cacerts» только в значении параметра -keystore, поскольку я передавал полный путь, как «C **:\Program Files\Java\jdk1.8.0_151\JRE\Lib\безопасность **».
Надеюсь, что это сработает
Ответ 4
Проверьте разрешения на запись в хранилище ключей.
Ответ 5
Для пользователей Mac убедитесь, что sudo и при запросе сначала введите пароль администратора, за которым последует пароль хранилища ключей, который обычно должен быть «changeit», если вы его не изменили.
Ответ 6
Если вы используете windows8:
- Нажмите кнопку «Пуск»
- В поле поиска введите command prompt
- В результате щелкните правой кнопкой мыши command prompt и выберите Run as administrator . Затем выполните команду keytool.
Ответ 7
Я даже запускаю командную строку в качестве администратора, но для меня это не с ошибкой ниже.
'keytool' is not recognized as an internal or external command, operable program or batch file.
Если путь к ключевому инструменту отсутствует в ваших системных путях, вам нужно будет использовать полный путь для использования keytool, который находится
Итак, команда должна быть как
"C:\Program Files\Java\jre\bin\keytool.exe" -importcert -alias certificateFileAlias -file CertificateFileName.cer -keystore cacerts
Ответ 8
У меня та же проблема в Windows 10 при использовании PowerShell, но работает, если я использую cmd.
Ответ 9
Сертификат был добавлен в keytool хранилища ключей: ошибка: java.io.FileNotFoundException: (доступ запрещен)
Я получаю эту ошибку. Я попытался запустить в режиме администратора. Это не сработало. Я скопировал папку jdk в другое место и запустил команду в каталоге keytool.exe. Тогда это сработало.
Ответ 10
Вы можете дать себе разрешение на устранение этой проблемы.
Щелкните правой кнопкой мыши на cacerts > выберите свойствa > выберите вкладку Securit > Разрешить все разрешения для всех имен групп и пользователей.
Ответ 11
- Просто запустите CMD в качестве администратора.
- Убедитесь, что вы используете правильный пароль доверия.
Ответ 12
Вы можете сохранить диск или путь (не C) EX: D\
C:\Program Files\Java\jre1.8.0_101\bin>keytool -genkey -alias server -keyalg RSA -keysize 2048 -keystore D:\myserver.jks -dname "CN=myserver,OU=IT-WebDev, O=TIACHOP, L=HCM, ST=0753, C=VN" && keytool -certreq -alias server -file D:\myserver.csr -keystore D:\myserver.jks
Java Keytool error after importing certificate , «keytool error: java.io.FileNotFoundException & Access Denied»
I’m trying to connect a Java Web API via HTTPS; however, an exception is thrown:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException
I followed these steps which I learned from online keytool & SSL cert tutorials:
- I copied the HTTPS URL into the browser, downloaded the SSL certificates & Installed them in the browser using Internet Explorer.
- Exported the certificates to a path on my computer, the certificates were saved as .cer
- Used the keytool’s import option. The command below executed without any errors.
keytool -import -alias downloadedCertAlias -keystore C:\path\to\my\keystore\cacerts.file -file C:\path\of\exportedCert.cer
However after that message, another exception was displayed:
keytool error: java.io.FileNotFoundException: C:\Program files\. \cacerts
Finally when I checked the keystore , the SSL certificate was not added and my application gives the same exception I was getting earlier when trying to connect:
(javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException)
Java Solutions
Solution 1 — Java
This could happen if you are not running the command prompt in administrator mode. If you are using windows 7, you can go to run, type cmd and hit Ctrl+Shift+enter. This will open the command prompt in administrator mode. If not, you can also go to start -> all programs -> accessories -> right click command prompt and click ‘run as administrator’.
Solution 2 — Java
I was having the same problem while importing the certificate in local keystore. Whenever i issue the keytool command i got the following error.
Certificate was added to keystore keytool error: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.8.0_151\jre\lib\security (Access is denied)
Following solution work for me.
- make sure you are running command prompt in Rus as Administrator mode
- Change your current directory to %JAVA_HOME%\jre\lib\security
- then Issue the below command
keytool -import -alias «mycertificatedemo» -file «C:\Users\name\Downloads\abc.crt» -keystore cacerts
- give the password changeit
- enter y
- you will see the following message on successful «Certificate was added to keystore»
Make sure you are giving the «cacerts» only in -keystore param value , as i was giving the full path like «C**:\Program Files\Java\jdk1.8.0_151\jre\lib\security**».
Solution 3 — Java
I had the same problem under Windows and could solve it by running cmd.exe as administrator (right-click in start menu, then «Run as administrator).
Solution 4 — Java
Check the write permissions on the keystore.
Solution 5 — Java
For Mac users make sure to sudo and when prompted first give your administrator password and that will be followed by keystore password which typically should be «changeit» unless you actually changed it.
Solution 6 — Java
If you are using windows8:
- Click start button
- In the search box, type command prompt
- From the result, right-click command prompt and click Run as administrator . Then execute the keytool command.
Solution 7 — Java
You can give yourself permissions to fix this problem.
Right click on cacerts > choose properties > select Securit tab > Allow all permissions to all the Group and user names.
Solution 8 — Java
I got this error too even I ran cmd as an Administrator.
The root cause is: The file is from VCS(subversion, perforce, etc.), and when I checked the properties of this file, its’ Attributes is Read-only.
- (1) disable the ‘Read-only’ Attribute;
- (2) check out from VCS, let the file under the status of read&write.
Solution 9 — Java
I even run the command prompt as Administrator but it didn’t work for me with the below error.
'keytool' is not recognized as an internal or external command, operable program or batch file.
If the path to the keytool is not in your System paths then you will need to use the full path to use the keytool, which is
So, the command should be like
"C:\Program Files\Java\jre\bin\keytool.exe" -importcert -alias certificateFileAlias -file CertificateFileName.cer -keystore cacerts
Solution 10 — Java
Make sure you running as Administrator. In Mac terminal:-
Solution 11 — Java
You can store orther disk or path (not C) EX : D\
C:\Program Files\Java\jre1.8.0_101\bin>keytool -genkey -alias server -keyalg RSA -keysize 2048 -keystore D:\myserver.jks -dname "CN=myserver,OU=IT-WebDev, O=TIACHOP, L=HCM, ST=0753, C=VN" && keytool -certreq -alias server -file D:\myserver.csr -keystore D:\myserver.jks
Solution 12 — Java
- Just run CMD as an administrator.
- Make sure your using the correct truststore password
DiaryFolio
Solution : Ensure the password is correct. Try password «changeit» (as it is the default) or the password might have been changed by someone. In which case contact your OS admin having root access and try to export the keytool entries as exporting doesn’t require password. (Step at top of this page). Carefully find the entries which you feel is required for your organisation, later create a cacerts file of your own and import these custom entries.
- Get link
- Other Apps
Labels
- Get link
- Other Apps
Popular posts from this blog
Create your own Passport Photo using GIMP
This tutorial is for semi-techies who knows a bit of GIMP (image editing). This tutorial is for UK style passport photo ( 45mm x 35 mm ) which is widely used in UK, Australia, New Zealand, India etc. This is a quick and easy process and one can create Passport photos at home If you are non-technical, use this link . If you want to create United States (USA) Passport photo or Overseas Citizen of India (OCI) photo, please follow this link How to Make your own Passport Photo — Prerequisite GIMP — One of the best image editing tools and its completely Free USB stick or any memory device to store and take to nearby shop A quality Digital camera Local Shops where you can print. Normally it costs (£0.15 or 25 US cents) to print 8 photos Steps (Video Tutorial attached blow of this page) Ask one of your colleague to take a photo of you with a light background. Further details of how to take a photo yourself Take multiple pictures so that you can choose from th
- Get link
- Other Apps
Syslog Standards: A simple Comparison between RFC3164 & RFC5424
Syslog Standards: A simple Comparison between RFC3164 (old format) & RFC5424 (new format) Though syslog standards have been for quite long time, lot of people still doesn’t understand the formats in detail. The original standard document is quite lengthy to read and purpose of this article is to explain with examples Some of things you might need to understand The RFC standards can be used in any syslog daemon (syslog-ng, rsyslog etc.) Always try to capture the data in these standards. Especially when you have log aggregation like Splunk or Elastic, these templates are built-in which makes your life simple. Syslog can work with both UDP & TCP Link to the documents the original BSD format ( RFC3164 ) the “new” format ( RFC5424 ) RFC3164 (the old format) RFC3164 originated from combining multiple implementations (Year 2001)
- Get link
- Other Apps