mirror of https://github.com/apache/cloudstack.git
CertUtils: export private key to pem format correctly (#2875)
This makes openssl rsa -in <file> -check pass, due to "RSA" string the validate of private key (pem file) by openssl fails. Also removes a commented import. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
8c0b9d6202
commit
0c943ab1f0
|
|
@ -75,8 +75,6 @@ import org.joda.time.DateTimeZone;
|
|||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
//import org.bouncycastle.x509.extension.SubjectKeyIdentifierStructure;
|
||||
|
||||
public class CertUtils {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(CertUtils.class);
|
||||
|
|
@ -132,7 +130,7 @@ public class CertUtils {
|
|||
}
|
||||
|
||||
public static String privateKeyToPem(final PrivateKey key) throws IOException {
|
||||
final PemObject pemObject = new PemObject("RSA PRIVATE KEY", key.getEncoded());
|
||||
final PemObject pemObject = new PemObject("PRIVATE KEY", key.getEncoded());
|
||||
final StringWriter sw = new StringWriter();
|
||||
try (final PemWriter pw = new PemWriter(sw)) {
|
||||
pw.writeObject(pemObject);
|
||||
|
|
|
|||
Loading…
Reference in New Issue