Skip to content
Snippets Groups Projects
Commit 0549995e authored by Gospodin Bodurov's avatar Gospodin Bodurov
Browse files

Merge branch 'put-certificate-in-pem-and-fix-public-key-pem-type' into 'master'

Store certificate in PEM, fixed keys PEM type

See merge request !5
parents c85e54fb 06cea1f7
No related branches found
No related tags found
1 merge request!5Store certificate in PEM, fixed keys PEM type
......@@ -116,7 +116,14 @@ func generateCertificate(publicKeyBytes []byte, caCertFilePath string, caPrivate
return nil, err
}
return certificateBytes, nil
certificatePemBlock := &pem.Block{
Type: "CERTIFICATE",
Bytes: certificateBytes,
}
certificatePemBytes := pem.EncodeToMemory(certificatePemBlock)
return certificatePemBytes, nil
}
func readPrivateKeyFromFile(fileName string) (*rsa.PrivateKey, error) {
......
......@@ -136,7 +136,7 @@ func generateKeyPair(keySize int) ([]byte, []byte, error) {
}
privateKeyPemBlock := &pem.Block{
Type: "RSA PRIVATE KEY",
Type: "PRIVATE KEY",
Bytes: pkcs8PrivateKeyBytes,
}
......@@ -148,7 +148,7 @@ func generateKeyPair(keySize int) ([]byte, []byte, error) {
}
publicKeyPemBlock := &pem.Block{
Type: "RSA PRIVATE KEY",
Type: "PUBLIC KEY",
Bytes: pkixPublicKeyBytes,
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment