Using Base64 encoded Public Key to verify RSA signature

前端 未结 3 1154
梦毁少年i
梦毁少年i 2020-12-06 00:29

In a nutshell, this is my problem:

private string publicKeyString = \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDVGUzbydMZS+fnkGTsUkDKEyFOGwghR234d5GjPnMIC0RFtXt         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 00:49

    First base64 is only an encoding of some binary data. There's more than one way to encode, in binary, an RSA public key. However if you got this from OpenSSL it's likely a DER-encoded RSAPublicKey structure.

     RSAPublicKey ::= SEQUENCE {
         modulus            INTEGER,    -- n
         publicExponent     INTEGER  }  -- e
    

    In general you would need a ASN.1 decoder, Mono.Security.dll provides one, but for such a simple structure you might want to do it by hand since ASN.1 is basically a Tag, Length and a Value.

提交回复
热议问题