Unable to build token
jyloo opened this issue · 2 comments
jyloo commented
I'm getting System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1. is there some special requirements for the private key? i'm guessing this has something to do with my private key
Dim sc As Byte() = Nothing
Using fs As New StreamReader(Server.MapPath("/secret.txt"))
fs.Read()
Dim x = fs.ReadToEnd()
sc = Encoding.UTF8.GetBytes(x) 'GetPem("RSA PRIVATE KEY", Encoding.Default.GetBytes(x))
End Using
Dim token = New PasetoBuilder(Of Version1)().
WithKey(sc).
AddClaim("example", "Hello Paseto!").
Expiration(DateTime.UtcNow.AddHours(24)).
AsPublic().
Build()
lt.Text = token
daviddesmet commented
How are your creating the private key? This test shows how the private key is created and consumed. Perhaps it could be of help?
jyloo commented
@idaviddesmet thanks for your kind guidance. Guess I'm doing it wrongly for the secret key previously.
Now everything works!