<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="https://forum.yubico.com/feed.php?f=5&amp;t=281" />

<title>Yubico Forum</title>
<subtitle>...visit our web-store at</subtitle>
<link href="https://forum.yubico.com/index.php" />
<updated>2009-03-05T15:50:52+01:00</updated>

<author><name><![CDATA[Yubico Forum]]></name></author>
<id>https://forum.yubico.com/feed.php?f=5&amp;t=281</id>
<entry>
<author><name><![CDATA[metamind]]></name></author>
<updated>2009-03-05T15:50:52+01:00</updated>
<published>2009-03-05T15:50:52+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=281&amp;p=1228#p1228</id>
<link href="https://forum.yubico.com/viewtopic.php?t=281&amp;p=1228#p1228"/>
<title type="html"><![CDATA[Re: decoding help]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=281&amp;p=1228#p1228"><![CDATA[
Think I have it. Added<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">        crypto.Padding = System.Security.Cryptography.PaddingMode.None<br /></div><p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=86">metamind</a> — Thu Mar 05, 2009 3:50 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[metamind]]></name></author>
<updated>2009-03-05T14:56:51+01:00</updated>
<published>2009-03-05T14:56:51+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=281&amp;p=1227#p1227</id>
<link href="https://forum.yubico.com/viewtopic.php?t=281&amp;p=1227#p1227"/>
<title type="html"><![CDATA[Re: decoding help]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=281&amp;p=1227#p1227"><![CDATA[
This is dot net 1.1<br />Also get the same error in VS2005<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent"><br />    Private Sub btDecrypt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btDecrypt.Click<br />        Dim crypto As New System.Security.Cryptography.RijndaelManaged<br />        Dim encryptedData As Byte() = FromHex(&quot;f9ef77d27b8fed0f088963be7d3e2f15&quot;)<br />        crypto.Key = FromHex(&quot;265670755823513b6d54423c79536560&quot;)<br />        crypto.IV = New Byte(encryptedData.Length - 1) {}<br /><br />        Dim encryptedMemStream As New System.IO.MemoryStream(encryptedData, 0, encryptedData.Length)<br />        Dim b() As Byte = New Byte(encryptedData.Length - 1) {}<br /><br />        Dim cs As New System.Security.Cryptography.CryptoStream(encryptedMemStream, crypto.CreateDecryptor(), System.Security.Cryptography.CryptoStreamMode.Read)<br /><br />        Try<br />            cs.Read(b, 0, encryptedData.Length - 1)<br />        Catch ex As System.Security.Cryptography.CryptographicException<br />            Throw New System.Security.Cryptography.CryptographicException(&quot;Unable to decrypt data. The provided key may be invalid.&quot;, ex)<br />        Finally<br />            cs.Close()<br />        End Try<br />        tbEncryptResult.Text = ToHex(b)<br />    End Sub<br /><br />    Shared Function ToHex(ByVal ba() As Byte) As String<br />        If ba Is Nothing OrElse ba.Length = 0 Then<br />            Return &quot;&quot;<br />        End If<br />        Const HexFormat As String = &quot;{0:X2}&quot;<br />        Dim sb As New System.Text.StringBuilder<br />        For Each b As Byte In ba<br />            sb.Append(String.Format(HexFormat, b))<br />        Next<br />        Return sb.ToString<br />    End Function<br /><br />    Shared Function FromHex(ByVal hexEncoded As String) As Byte()<br />        If hexEncoded Is Nothing OrElse hexEncoded.Length = 0 Then<br />            Return Nothing<br />        End If<br />        Try<br />            Dim l As Integer = Convert.ToInt32(hexEncoded.Length / 2)<br />            Dim b(l - 1) As Byte<br />            For i As Integer = 0 To l - 1<br />                b(i) = Convert.ToByte(hexEncoded.Substring(i * 2, 2), 16)<br />            Next<br />            Return b<br />        Catch ex As Exception<br />            Throw New System.FormatException(&quot;The provided string does not appear to be Hex encoded:&quot; &amp; _<br />                Environment.NewLine &amp; hexEncoded &amp; Environment.NewLine, ex)<br />        End Try<br />    End Function<br /><br /></div><br /><br />Are we sure that this is indeed a valid key / encrypted pair?<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=86">metamind</a> — Thu Mar 05, 2009 2:56 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[network-marvels]]></name></author>
<updated>2009-03-05T14:29:35+01:00</updated>
<published>2009-03-05T14:29:35+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=281&amp;p=1226#p1226</id>
<link href="https://forum.yubico.com/viewtopic.php?t=281&amp;p=1226#p1226"/>
<title type="html"><![CDATA[Re: decoding help]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=281&amp;p=1226#p1226"><![CDATA[
It seems to be a dot net specific issue. We believe this error is related to the size of the data stream. <br /><br />We would appreciate if you can provide us the sample code. This will help us determining the exact cause of the problem you are facing.<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=280">network-marvels</a> — Thu Mar 05, 2009 2:29 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[metamind]]></name></author>
<updated>2009-03-05T13:22:53+01:00</updated>
<published>2009-03-05T13:22:53+01:00</published>
<id>https://forum.yubico.com/viewtopic.php?t=281&amp;p=1224#p1224</id>
<link href="https://forum.yubico.com/viewtopic.php?t=281&amp;p=1224#p1224"/>
<title type="html"><![CDATA[decoding help]]></title>

<content type="html" xml:base="https://forum.yubico.com/viewtopic.php?t=281&amp;p=1224#p1224"><![CDATA[
Hi,<br /><br />I am implimenting a server side parser in dot net and having a spot of bother. I have:<br /><br />1: reset the otp on a yubikey. the aes key I used was: 265670755823513b6d54423c79536560<br />2: generated a string. with the key's prefix removed this has produced the following strings (format yubiHex - realHex)<br /><br />cnkkndvrckucleuvinfiihnvhllvkgnl - 0b99b2fc09e0a3ef7b4776bf6aaf95ba<br />vkuviitdinjvutcvcjjkhenuiteudvbg - f9ef77d27b8fed0f088963be7d3e2f15<br />jtcbldtujkdjfugnubuuhvbgijdgnvgv - 8d01a2de89284e5be1ee6f157825bf5f<br /><br />3: now, the next step, as i understand it, is to decode the real hex. however when i try to aes-decrypt f9ef77d27b8fed0f088963be7d3e2f15 with the key 265670755823513b6d54423c79536560 i get &quot;PKCS7 padding is invalid and cannot be removed&quot;.<br /><br />i suspect i am trying to do the wrong thing but I'm not 100% sure i am using the aes decryption correctly either so any pointers would be much appreciated.<br /><br />Thanks<p>Statistics: Posted by <a href="https://forum.yubico.com/memberlist.php?mode=viewprofile&amp;u=86">metamind</a> — Thu Mar 05, 2009 1:22 pm</p><hr />
]]></content>
</entry>
</feed>