<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python API - NaElement crypt/decrypt child string problem in Software Development Kit (SDK) and API Discussions</title>
    <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/Python-API-NaElement-crypt-decrypt-child-string-problem/m-p/110079#M1626</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I would like to ask for an advice, why I'm getting an error when using methods child_add_string_enc() in NaElement object in python (v.2.6.6. Oracle Linux 6.7):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "crypt_test.py", line 7, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x.child_add_string_encrypted("crypt-pwd", passwd)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "NaElement.py", line 270, in child_add_string_encrypted&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; encrypted_value = self.RC4(key,value)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "NaElement.py", line 365, in RC4&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; box = self.prepare_key(key)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "NaElement.py", line 402, in prepare_key&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; k = unpack('C*',key)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;struct.error: bad char in struct format&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;ok then, I have added "import struct" in the NaElement.py file, then got this error:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "crypt_test.py", line 8, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x.child_add_string_encrypted("crypt-pwd", passwd)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "NaElement.py", line 270, in child_add_string_encrypted&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; encrypted_value = self.RC4(key,value)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "NaElement.py", line 365, in RC4&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; box = self.prepare_key(key)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "NaElement.py", line 402, in prepare_key&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; k = unpack('C*',key)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;struct.error: bad char in struct format&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my test python code:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;from NaElement import *&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;import struct&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;passwd = "Test-string-to-encrypt"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;x = NaElement("test")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;x.child_add(NaElement("plain-pwd", passwd))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;x.child_add_string_encrypted("crypt-pwd", passwd)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the problem? Python v.2.6.6 should be supported, do I need any special packages to install? Quite the same code in Perl (using perl APIs with pack/unpack functions) works withould problems...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help in advance.&lt;/P&gt;&lt;P&gt;Rostislav&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jun 2025 23:13:38 GMT</pubDate>
    <dc:creator>pilkar</dc:creator>
    <dc:date>2025-06-04T23:13:38Z</dc:date>
    <item>
      <title>Python API - NaElement crypt/decrypt child string problem</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/Python-API-NaElement-crypt-decrypt-child-string-problem/m-p/110079#M1626</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I would like to ask for an advice, why I'm getting an error when using methods child_add_string_enc() in NaElement object in python (v.2.6.6. Oracle Linux 6.7):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "crypt_test.py", line 7, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x.child_add_string_encrypted("crypt-pwd", passwd)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "NaElement.py", line 270, in child_add_string_encrypted&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; encrypted_value = self.RC4(key,value)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "NaElement.py", line 365, in RC4&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; box = self.prepare_key(key)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "NaElement.py", line 402, in prepare_key&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; k = unpack('C*',key)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;struct.error: bad char in struct format&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;ok then, I have added "import struct" in the NaElement.py file, then got this error:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "crypt_test.py", line 8, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x.child_add_string_encrypted("crypt-pwd", passwd)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "NaElement.py", line 270, in child_add_string_encrypted&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; encrypted_value = self.RC4(key,value)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "NaElement.py", line 365, in RC4&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; box = self.prepare_key(key)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; File "NaElement.py", line 402, in prepare_key&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; k = unpack('C*',key)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;struct.error: bad char in struct format&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my test python code:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;from NaElement import *&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;import struct&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;passwd = "Test-string-to-encrypt"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;x = NaElement("test")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;x.child_add(NaElement("plain-pwd", passwd))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;x.child_add_string_encrypted("crypt-pwd", passwd)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the problem? Python v.2.6.6 should be supported, do I need any special packages to install? Quite the same code in Perl (using perl APIs with pack/unpack functions) works withould problems...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help in advance.&lt;/P&gt;&lt;P&gt;Rostislav&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 23:13:38 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/Python-API-NaElement-crypt-decrypt-child-string-problem/m-p/110079#M1626</guid>
      <dc:creator>pilkar</dc:creator>
      <dc:date>2025-06-04T23:13:38Z</dc:date>
    </item>
  </channel>
</rss>

