Mailing List Archive

scd: binary data returned when sending direct APDU
Hello,

I am trying to send arbitrary APDU commands via scd. When doing that I
noticed that scd answers me with binary data. For example:

gpg-connect-agent
> scd apdu 00 A4 04 00 07 A0 00 00 05 27 21 01
D yZ??... <other binary data>
OK


As assuan protocol is supposed to transmit utf-8 encoded string data, I
would have expected an hexified string as returned data (as the input
data is). Is that a bug or the expected behaviour?


Thank you very much,
Alexandre.

_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
https://lists.gnupg.org/mailman/listinfo/gnupg-users
Re: scd: binary data returned when sending direct APDU [ In reply to ]
On Mittwoch, 21. Dezember 2022 17:51:39 CET Alexandre Vaissière via Gnupg-
users wrote:
> I am trying to send arbitrary APDU commands via scd. When doing that I
> noticed that scd answers me with binary data. For example:
>
> gpg-connect-agent
> > scd apdu 00 A4 04 00 07 A0 00 00 05 27 21 01
> D yZ??... <other binary data>
> OK
>
> As assuan protocol is supposed to transmit utf-8 encoded string data, I
> would have expected an hexified string as returned data (as the input
> data is). Is that a bug or the expected behaviour?

I suppose this is intended behavior (because data is often text and you don't
want to get that in hex). You may want to use `gpg-connect-agent --hex`.

Regards,
Ingo
Re: scd: binary data returned when sending direct APDU [ In reply to ]
On Wed, 21 Dec 2022 18:58, Ingo Klöcker said:

> I suppose this is intended behavior (because data is often text and you don't
> want to get that in hex). You may want to use `gpg-connect-agent --hex`.

Yes, that is indeed intended. D(data) lines may return arbitrary data
with only a few values being %-escaped. Some commands have options to
return the result as S(status) lines which are then UTF-8.

BTW, in gpg-connect-agent you may also use "/hex" or "/nohex" to enable
hex style dumps of D lines. Try "/help" for other gpg-connect-agent
commands.


Salam-Shalom,

Werner

--
The pioneers of a warless world are the youth that
refuse military service. - A. Einstein