how to sign bytes using my own rsa private key using rs256 algorithm?

后端 未结 4 616
闹比i
闹比i 2020-12-04 03:03

I have my own private key string, i.e.

-----BEGIN RSA PRIVATE KEY-----

MIICXAIBAAKBgQCSAYYgzvGTww....
....
....
.....
3yUMYj9oYzqdrRHP0XgD0cEEvyqPBwLaNsRdFw         


        
4条回答
  •  死守一世寂寞
    2020-12-04 03:37

    I recently had to achieve something similar and came across an error "Invalid Algorithm Specified" when signing my payload, so have solved my specific issue I thought I'd share the code. I think that may be useful to you too.

    You can find a full explanatory [ReadME][2], and source code at Karama.Jwt.Public. I happen to be using a different library for generating my JWT, namely JOSE, but I think that this is incidental, and for completeness, there is a project achieving the same end using no third party libraries.

    Please let me know how you get on.

提交回复
热议问题