![]() |
|
#5
|
|||
|
|||
|
Anyone know how to correctly convert the base64 encoded P and Q values back to a proper integer?
I am trying to use the systems.numerics biginteger format and the output isn't looking correct. My Byte Arrays are coming back correctly from my RSAGetP function, as if I convert the array back to base64 format it matches the original RSA XML Code:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim PBytes() As Byte = RSAGetP(txtPrivateKey.Text)
Dim PValue As New BigInteger(PBytes)
Dim QBytes() As Byte = RSAGetQ(txtPrivateKey.Text)
Dim QValue As New BigInteger(QBytes)
Dim MBytes() As Byte = RSAGetM(txtPrivateKey.Text)
Dim MValue As New BigInteger(MBytes)
TextBox1.Text = PValue.ToString
TextBox2.Text = QValue.ToString
TextBox3.Text = MValue.ToString
End Sub
Code:
Function PrepareRSA(Bytes() As Byte)
Array.Reverse(Bytes)
If (Bytes((Bytes.Length - 1)) > 127) Then
Array.Resize(Bytes, (Bytes.Length + 1))
Bytes((Bytes.Length - 1)) = 0
End If
Return Bytes
End Function
Last edited by psgama; 12-31-2017 at 13:52. |
| The Following User Says Thank You to psgama For This Useful Post: | ||
niculaita (12-31-2017) | ||
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Aspack OEP (simple) | CodeCracker | Community Tools | 0 | 12-25-2020 17:41 |