(ca *CA)
| 113 | } |
| 114 | |
| 115 | func (s *Java) UninstallCA(ca *CA) (bool, error) { |
| 116 | s.init() |
| 117 | |
| 118 | if s.keytoolPath == "" { |
| 119 | return false, Error{ |
| 120 | Op: OpUninstall, |
| 121 | Warning: ErrNoKeytool, |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | args := []string{ |
| 126 | "-delete", |
| 127 | "-alias", ca.UniqueName, |
| 128 | "-keystore", s.cacertsPath, |
| 129 | "-storepass", s.StorePass, |
| 130 | } |
| 131 | out, err := s.execKeytool(s.SysFS.Command(s.keytoolPath, args...)) |
| 132 | if bytes.Contains(out, []byte("does not exist")) { |
| 133 | return false, nil // cert didn't exist |
| 134 | } |
| 135 | if err != nil { |
| 136 | return false, fatalCmdErr(err, "keytool -delete", out) |
| 137 | } |
| 138 | return true, nil |
| 139 | } |
| 140 | |
| 141 | // execKeytool will execute a "keytool" command and if needed re-execute |
| 142 | // the command with commandWithSudo to work around file permissions. |
nothing calls this directly
no test coverage detected