From 889f2868e6fdbd3b99c5c078d96d0c5b1e34b182 Mon Sep 17 00:00:00 2001 From: Zenkie Bear Date: Fri, 10 May 2024 16:40:07 +0800 Subject: [PATCH] fix: Modified PEM file type string The standard PEM key file should named "RSA PRIVATE KEY" or "RSA PUBLIC KEY". fixed: #42 --- .gitignore | 3 ++- _storage/storage.go | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 6152713..095f321 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ count.out coverage.out DoNotUseThisCAPATHTestOnly/ docs-test/ -cover.out \ No newline at end of file +cover.out +store \ No newline at end of file diff --git a/_storage/storage.go b/_storage/storage.go index 66f0fe5..121b2ad 100644 --- a/_storage/storage.go +++ b/_storage/storage.go @@ -1,6 +1,6 @@ // MIT License // -// Copyright (c) 2020, Kairo de Araujo +// # Copyright (c) 2020, Kairo de Araujo // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -60,7 +60,7 @@ func savePEMKey(fileName string, key *rsa.PrivateKey) { checkError(err) var privateKey = &pem.Block{ - Type: "PRIVATE KEY", + Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key), } @@ -73,7 +73,7 @@ func savePublicPEMKey(fileName string, pubkey rsa.PublicKey) { checkError(err) var pemkey = &pem.Block{ - Type: "PUBLIC KEY", + Type: "RSA PUBLIC KEY", Bytes: asn1Bytes, }