1
/* gpga-prot.h - GnuPG Agent protocol definition
2
* Copyright (C) 2000 Free Software Foundation, Inc.
4
* This file is part of GnuPG.
6
* GnuPG is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* GnuPG is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22
* The gpg-agent protocol:
23
* The protocol is connection based and runs over a Unix Domain socket.
24
* The client requests a service from the server and waits for the result.
25
* A connection request starts with a magic string to transfer the
26
* version number the followed by the regular traffic. All numbers
27
* are transfered in network-byte-order, strings are prefixed with a
28
* 32 bit length and NOT 0 terminated.
29
* The magic string is:
30
* 0x47, 0x50, 0x47, 0x41, 0x00, 0x00, 0x00, 0x01
31
* which nicely fits into 2 32 bit words.
32
* The server does not respond to this magic string if the protocol
33
is supported; otherwise it will return an error packet and close
35
Standard request and reply packets are composed like this
36
u32 Length of following packet ( 4 <= n < 2048 )
37
u32 Request/Reply type or error code
38
n-bytes Data specific to the request/reply
40
Request codes are just the given number,
41
Reply codes are all to be ORed with 0x00010000,
42
Error codes are all to be ORer with 0x00020000.
48
GET_PASSPHRASE, expected data:
49
20 Bytes fingerprint of the key
50
(use all zeroes to get a passphrase not associated with a key)
51
n Bytes with the text to be displayed in case the
52
passphrase is not cached or the fingerprint was all zero.
54
CLEAR_PASSPHRASE, expected data:
55
20 Bytes fingerprint of the key
57
Returns either OKAY or NO_PASSPHRASE
59
HAVE_PASSPHRASE, expected data:
60
20 Bytes fingerprint of the key
62
Returns either OKAY or NO_PASSPHRASE
68
Data may be interpreted as the version string
70
GOT_PASSPHRASE (reply code 2)
71
u32 Length of passphrase
73
m bytes padding so that the packets have some standard length
82
User canceled the input
85
No user intercation possible and passphrase not available.
86
Also return as answer on HAVE_PASSPHRASE etc.
89
Returned when the user does not repeat the passphrase correctly
97
#ifndef GPG_GPGA_PROT_H
98
#define GPG_GPGA_PROT_H 1
100
enum gpga_protocol_codes {
102
GPGA_PROT_GET_VERSION = 1,
103
GPGA_PROT_GET_PASSPHRASE = 2,
104
GPGA_PROT_CLEAR_PASSPHRASE= 3,
105
GPGA_PROT_SHUTDOWN = 4,
109
GPGA_PROT_REPLY_BASE = 0x10000,
110
GPGA_PROT_OKAY = 0x10001,
111
GPGA_PROT_GOT_PASSPHRASE = 0x10002,
114
GPGA_PROT_ERROR_BASE = 0x20000,
115
GPGA_PROT_PROTOCOL_ERROR = 0x20001,
116
GPGA_PROT_INVALID_REQUEST= 0x20002,
117
GPGA_PROT_CANCELED = 0x20003,
118
GPGA_PROT_NO_PASSPHRASE = 0x20004,
119
GPGA_PROT_BAD_PASSPHRASE = 0x20005,
120
GPGA_PROT_INVALID_DATA = 0x20006,
121
GPGA_PROT_NOT_IMPLEMENTED= 0x20007,
122
GPGA_PROT_UI_PROBLEM = 0x20008,
127
#endif /*GPG_GPGA_PROT_H*/