File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 66 "crypto/rsa"
77 "crypto/x509"
88 "encoding/pem"
9+ "os"
910 "testing"
1011
1112 "github.com/davecgh/go-spew/spew"
@@ -116,6 +117,28 @@ func TestParseRSAPrivateKey(t *testing.T) {
116117 })
117118}
118119
120+ func TestImportRSAPublicKeyBlob (t * testing.T ) {
121+ t .Run ("common" , func (t * testing.T ) {
122+ key , err := os .ReadFile ("testdata/public.key" )
123+ require .NoError (t , err )
124+
125+ publicKey , err := ImportRSAPublicKeyBlob (key )
126+ require .NoError (t , err )
127+ require .NotNil (t , publicKey )
128+ })
129+ }
130+
131+ func TestImportRSAPrivateKeyBlob (t * testing.T ) {
132+ t .Run ("common" , func (t * testing.T ) {
133+ key , err := os .ReadFile ("testdata/private.key" )
134+ require .NoError (t , err )
135+
136+ privateKey , err := ImportRSAPrivateKeyBlob (key )
137+ require .NoError (t , err )
138+ require .NotNil (t , privateKey )
139+ })
140+ }
141+
119142func TestExportRSAPublicKeyBlob (t * testing.T ) {
120143 key , err := rsa .GenerateKey (rand .Reader , 2048 )
121144 require .NoError (t , err )
You can’t perform that action at this time.
0 commit comments