spkac_test.go 1.4 KB

12345678910111213141516171819202122232425262728
  1. package gold
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. // Generated using:
  7. // openssl spkac -key privkey.pem -challenge hello -out spkac.cnf
  8. var spkacRSABase64 = `MIICRTCCAS0wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDK/2gvbZk5wajwkX6wwhCrG39NetMycseg8nFgN23MKSLbjU/JspvCrk6jlHNs8d1+FcFyU/AHqYYiY60mSMymDetnho/iqW5sThziyOaVmQ7I7JM6Lqr1tD3376VTvq/1KKrIJrnyCEuxeysflFpS+uTY5X5YV5n8AUPQhjr0aJXnIAI0SryLd0KeSGb+p7uxlmKG7Q8mxl1wel3WXEFr1oVLa61BHfbO8IhrAV8bUBsc0tWX/OSZc611exX1XZ/f3ujxRaL96xraN7AS7/zNI024r4261jPnVTpdFwf2CcnfU7rwCjgcezfBDcIVOUliyUfh1QTRZEYS4LUUVHAHAgMBAAEWBWhlbGxvMA0GCSqGSIb3DQEBBAUAA4IBAQCIBcbE+nw/vpjLvdl7EVnX4TWpKxDej92MOafyaOjNmy/iVhto57Lr+jBhm0A1oHpmGXLarkQPSLcXndZJFm/WSdHZ5pids+fEpe9yyMhgYYkVqqNbnGQmgSrmRZjIbzF6J69SaYXqJ1jQAZ4RrxRsgimfUfGw3C59yytdqkqllg2ojZe158vRlO/X6ysyCevchT9InDAWXE8YM/LBaI6jSlAz1BUFw0phpnAWTpULjMoP45QelY26gfNT1oDD+7PXAiEeo101kba67UcKXr8/7Z05iUONvkE+X1nNLynpvSskz7hha0pjtR+ipDVL9vIQxBFZ1xwrbbOj1fmIKzaE`
  9. func TestParseSPKAC(t *testing.T) {
  10. _, err := ParseSPKAC(spkacRSABase64)
  11. assert.NoError(t, err)
  12. }
  13. // func TestCreateCertificateFromSPKAC(t *testing.T) {
  14. // uri := "https://example.org/person/card#me"
  15. // name := "User Test"
  16. // newSpkac, err := NewSPKACx509(uri, name, spkacRSABase64)
  17. // assert.NoError(t, err)
  18. // webid, err := WebIDFromCert(newSpkac)
  19. // assert.NoError(t, err)
  20. // assert.Equal(t, uri, webid)
  21. // }