- James Moore
- PowerBuilder
- Tuesday, 22 October 2019 06:27 PM UTC
I'm trying to generate and sign a JWT using a RSA private key generated from an external source in PB2017 R3. When I call AsymmetricSign, I get an "Invalid 'privKey' in AsymmetricSign" error.
I've read the article here, but it leaves out the part that prepares the RSA private key (of_getrsakey).
What am I missing?
Thanks,
James
Sample code:
blob lblb_priv, lblb_SHA
string ls_key
coderobject l_Coder
crypterobject l_Crypt
l_Crypt = create crypterobject
l_Coder = create coderobject
ls_key = &
"MIIEowIBAAKCAQEAtTQvE7WxbNX8ULDifGJLLs69A3xWLUqx5s6/i47v9bMVAVMY" +&
"89msItFXHDbH0Jg41y7eHjQnIPrb0jz3naIpr1aiA95e3d2JqjPWjIY4vjwP6SUN" +&
"UHI8NVV/9C9khZBYU+rvfi2jeRRXAC+VMTvh/Wh+DRgc0tLMbOm8iKVehQDgGYQn" +&
"JT7lPm4z2kl35e1r8rox01el476NTL0/ES3cn+uORkxaqvqC4fokP9jZk7KeEsXI" +&
"7t9LmdqoBoNcZDlP63eX81qkQsEBt/7r5ssLISJgDfYJ8C6mKRvxqUefflbMjZNZ" +&
"z7OTA/KECktsq6r4U9u1gIMH+QZmdAC14Iy4rwIDAQABAoIBAFnIOWsyo26huBrj" +&
"CdVHfqj6lnybprdaQztxRUcI06yRxt6ZJcvtFnVJ9DdujSK1ybQU7MlaXejhYvmQ" +&
"a8AXEUBnVG9GRwr3Mba7aJrIBmV7rQZ/7VDmyR5D9tougUgMdTdfOLr0MgNUKKdW" +&
"7D0wxpCgrZQfVmi/ObrdNSUfiu2q41lZ1np67Q3iRaE1laFWrRP1AI6c/wCT4xQf" +&
"yBgVDRLm9QqAFqRY2D91p72ZGi27AI5UYTl+iGUxvPmvCJcDfrcBotf9lWoZJ4Bc" +&
"3kDdp/msyOC0x4FExVM8bZms1eeyH7uL6LY83lpzYWha3J21f2tt+K6+PQY3ChO8" +&
"LZm5GMECgYEA5/az1hd/u0+fDz1FyaeK7DuLWaBV4CdCaOllUPdGbgrVt0KpmDOl" +&
"sslVCbHOOFH9TrsQz0pXppUeJJ5Soq73jD5fbOkmJE+quymw6gasj/1adgmREkYH" +&
"2j1BNneeuDPKhos92Qk5Vm8KNoScgXhYj96Lgov+5/DRn4XgqQvkt2UCgYEAx/r5" +&
"0V3VjqYYVto60A67sSQ20ZyKty+wxsrhpB8ZJ0A5ia3iMuJtf/7Niah2ChZ28o55" +&
"wZcpNt6P+A8asjfXkqa4uqMFB1zdwKWbJwqY5IjYGlktt3meAmnamTbgF8GPbnSG" +&
"SRFcPgmixQKHFSMozf5CGiGuuwW24zoDBwt5YIMCgYEAvQM/guJfCKhWebp51Vma" +&
"T+gtInkNwLr82DPmhNUZJK3be5rsSsM677YyftXNrgLRH4g6qE5xoaG8kCYaO8nK" +&
"mRJx+3L3y3rHKf9M00Vg82uEfM5K0dMSrvhe3R0Xzg0VqBBp8yIbAJ02ezoPtUf1" +&
"EjZLA7NDoIeQqCYU7GpukikCgYBdGgQaK/RTkBI+xSSiXmmVY8W9uoJ+HE7RjfyU" +&
"uwGr22OuLGzlwbK25zprfylNMv43mIsozKYcbGtcUjPcitDq7oGMKn8Z2WtH2BGu" +&
"kGlz5B2vzprRE2azuvJRaFHV3YBYLRmjhNiL7VKBI9cdyRujI19E6S9+1H87tHNa" +&
"YUYl3wKBgEQPatE3miykvD+g46XJAOmEBwcuaRI8Q+MyC1oTrCK85ZUb8azHOPCi" +&
"BsDODpEJnY3uyh0Pe+zwxBKfKXhsNyDo1HgOO6Mkr6qBRGk9iYy/edSwaP+wtcNj" +&
"REQFAIo/6a+Olpx7+CCZChe0fFx5v3k6bXZPTLHplHqV6RQiNQEJ"
lblb_priv = l_Coder.base64Decode(ls_key)
lblb_SHA = l_Crypt.SHA(SHA256!, blob("TEST.TEST", encodingUTF8!))
l_Crypt.AsymmetricSign(RSA!, lblb_SHA, lblb_priv) //
destroy l_Crypt
destroy l_Coder
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.