Hello,
I can’t send keys from gpg command line, I can search and recv without problems.
gpg --keyserver hkp://keyserver.local --recv-keys 23E89FACE47CC132 -> Works
gpg --keyserver hkp://keyserver.local --search-keys 23E89FACE47CC132 -> Works
gpg --keyserver hkp://keyserver.local --refresh-keys -> Works
gpg --keyserver hkp://keyserver.local --send-keys 23E89FACE47CC132 - Fails
gpg: sending key 23E89FACE47CC132 to hkp://keyserver.local
gpg: keyserver send failed: No data
gpg: keyserver send failed: No data
Tried with hkp and hkps, same results
The server is proxied by nginx, here the config file:
server {
listen 0.0.0.0:80 default_server;
listen 0.0.0.0:11371 default_server;
server_name default_server;
server_tokens off;
proxy_set_header X-Real-IP $proxy_protocol_addr;
proxy_set_header X-Forwarded-For $proxy_protocol_addr;
# App rewrites
rewrite ^/verify/(.*)/(.*) /api/v1/key?op=verify&keyId=$1&nonce=$2;
rewrite ^/remove/(.*)/(.*) /api/v1/key?op=verifyRemove&keyId=$1&nonce=$2;
rewrite ^/download/(.*) /pks/lookup?op=get&options=mr&search=$1;
rewrite ^/d/(.*) /pks/lookup?op=get&options=mr&search=$1;
location / {
proxy_pass http://127.0.0.1:8888;
proxy_pass_header Server;
proxy_ignore_client_abort on;
client_max_body_size 8m;
}
}
server {
listen 0.0.0.0:443 default_server ssl;
listen 0.0.0.0:11372 default_server ssl;
ssl_certificate /etc/nginx/certs/raclus.net-wildcard-chain.crt;
ssl_certificate_key /etc/nginx/certs/raclus.net-wildcard.key;
ssl_dhparam /etc/nginx/certs/ssl-dhparams.pem;
server_name default_server;
server_tokens off;
proxy_set_header X-Real-IP $proxy_protocol_addr;
proxy_set_header X-Forwarded-For $proxy_protocol_addr;
# App rewrites
rewrite ^/verify/(.*)/(.*) /api/v1/key?op=verify&keyId=$1&nonce=$2;
rewrite ^/remove/(.*)/(.*) /api/v1/key?op=verifyRemove&keyId=$1&nonce=$2;
rewrite ^/download/(.*) /pks/lookup?op=get&options=mr&search=$1;
rewrite ^/d/(.*) /pks/lookup?op=get&options=mr&search=$1;
location / {
proxy_pass http://127.0.0.1:8888;
proxy_pass_header Server;
proxy_ignore_client_abort on;
client_max_body_size 8m;
}
}
If I post the key with the webpage’s form works fine, I can receive the mail and validate it without any issue.
пытаюсь следуйте инструкциям в http://packaging.ubuntu.com/singlehtml/ создать deb пакет для некоторых программ…
Я должен был начать с генерации ключа GPG
$ gpg --gen-key
затем загрузите открытую часть вашего ключа на сервер ключей
$ gpg --send-keys --keyserver keyserver.ubuntu.com 12345678
gpg: sending key 12345678 to hkp server keyserver.ubuntu.com
gpg: keyserver timed out
gpg: keyserver send failed: keyserver error
попытался добавить порт 80, потому что я читал что-то о брандмауэре, блокирующем эти запросы
gpg --send-keys --keyserver hkp://keyserver.ubuntu.com:80 C58C1F62
gpg: sending key C58C1F62 to keyserver.ubuntu.com:80
gpgkeys: no keyserver host provided
gpg: keyserver internal error
gpg: keyserver send failed: keyserver error
пробовал другие серверы, которые я нашел поиск этих ошибок на net
$ gpg --send-keys --keyserver sks-keyservers.net:80 12345678
gpg: sending key 12345678 to keyserver.sks-keyservers.net:80
gpgkeys: no keyserver host provided
gpg: keyserver internal error
gpg: keyserver send failed: keyserver error
$ gpg --send-keys --keyserver pgp.mit.edu:80 12345678
gpg: sending key 12345678 to pgp.mit.edu:80
gpgkeys: no keyserver host provided
gpg: keyserver internal error
gpg: keyserver send failed: keyserver error
тоже пробовал
gpg --send-keys --keyserver keyserver.pgp.com:80 12345678
gpg --send-keys --keyserver keyserver.sks-keyservers.net:80 12345678
(на случай, если мне понадобится «сервер ключей»)
все с той же ошибкой.
что мне не хватает ?
обновление: изменен порядок опций и добавлен hkp: protocol — и я все еще там, где начал — с небольшим улучшением в сообщении
$ gpg --keyserver hkp://pool.sks-keyservers.net --send-keys 12345678
gpg: sending key 12345678to hkp server pool.sks-keyservers.net
gpg: keyserver timed out
gpg: keyserver send failed: keyserver error
Edit: я прочитал, что отсутствующий хост сервера ключей может быть неправильным сообщением, на самом деле это означает, что ключ не существует на сервере… Но если я отправлю его, конечно, его не будет.
gpg --send-keys --keyserver keyserver.ubuntu.com:80 C58C1F62
gpg: sending key C58C1F62 to keyserver.ubuntu.com:80
gpgkeys: no keyserver host provided
gpg: keyserver internal error
gpg: keyserver send failed: keyserver error
dig keyserver.ubuntu.com
; <<>> DiG 9.8.1-P1 <<>> keyserver.ubuntu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40676
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;keyserver.ubuntu.com. IN A
;; ANSWER SECTION:
keyserver.ubuntu.com. 217 IN A 91.189.90.55
keyserver.ubuntu.com. 217 IN A 91.189.89.49
;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Sep 30 12:41:52 2014
;; MSG SIZE rcvd: 70
что означает, что сервер существует ? Но раздел вопроса выглядит пустым…
gpg --send-keys --keyserver hkp://keyserver.ubuntu.com:80 C58C1F62
gpg: sending key C58C1F62 to hkp server keyserver.ubuntu.com
gpgkeys: HTTP post error 7: couldn't connect: eof
gpg: keyserver internal error
gpg: keyserver send failed: keyserver error
dig hkp://keyserver.ubuntu.com
; <<>> DiG 9.8.1-P1 <<>> hkp://keyserver.ubuntu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 968
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;hkp://keyserver.ubuntu.com. IN A
;; AUTHORITY SECTION:
ubuntu.com. 899 IN SOA ns1.canonical.com. hostmaster.canonical.com. 2014093001 10800 3600 604800 3600
;; Query time: 164 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Sep 30 13:08:37 2014
;; MSG SIZE rcvd: 105
Я также попытался добавить опцию для прокси…
gpg --keyserver-options http-proxy='http://10.1.1.1:1234/' --keyserver hkp://keyserver.ubuntu.com:80 --send-keys C58C1F62
gpg: sending key C58C1F62 to hkp server keyserver.ubuntu.com
gpgkeys: HTTP post error 7: couldn't connect: eof
gpg: keyserver internal error
gpg: keyserver send failed: keyserver error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
hi
i m trying to send the key using sockets ..i made som changes to d original code by using the objects..but it shows d error :
BadPaddingException: javax.crypto.BadPaddingException: Given final block not properly padded
i m enclosing the codes : plz help me
SERVER CODE
import java.net.*;
import java.io.*;
import javax.crypto.*;
import javax.crypto.spec.*;
import java.security.*;
import java.security.spec.*;
import java.util.*;
class Server
{
public static void main(String a[]) throws IOException
{
new Server().listen(1450);
}
public void listen(int port) throws IOException
{
ServerSocket serverSocket = new ServerSocket(1450);
new SocketHandler(serverSocket.accept()).start();
}
class SocketHandler extends Thread
{
Socket socket = null;
SocketHandler(Socket socket)
{
this.socket = socket;
}
public void run()
{
try
{
SecretKey secretKey = null;
File file = new File("file.jpg");
OutputStream fileOutputStream = new FileOutputStream(file);
ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
int fileSize = in.readInt();
byte[] encryptedBytes = new byte[fileSize * 8];
byte[] bytes = new byte[fileSize];
secretKey = (SecretKey)in.readObject();
// Create Cipher
Cipher desCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
desCipher.init(Cipher.DECRYPT_MODE, secretKey);
int i = -1;
while (true)
{
i = in.read(encryptedBytes, 0, encryptedBytes.length);
bytes = desCipher.doFinal(encryptedBytes);
if (i == -1)
break;
fileOutputStream.write(bytes, 0, i);
}
in.close();
fileOutputStream.flush();
fileOutputStream.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
catch(ClassNotFoundException cnfe)
{
cnfe.printStackTrace();
}
catch (NoSuchPaddingException e)
{
System.err.println("Padding problem: " + e);
}
catch (NoSuchAlgorithmException e)
{
System.err.println("Invalid algorithm: " + e);
}
catch (InvalidKeyException e)
{
System.err.println("Invalid key: " + e);
}
catch (IllegalBlockSizeException e)
{
System.err.println("IllegalBlockSizeException: " + e);
}
catch (BadPaddingException e)
{
System.err.println("BadPaddingException: " + e);
}
finally
{
try
{
socket.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
}
}
}
ClIENT CODE
import java.net.*;
import java.io.*;
import javax.crypto.*;
import javax.crypto.spec.*;
import java.security.*;
import java.security.spec.*;
import java.util.*;
class Client
{
public static void main(String a[])
{
ObjectOutputStream out = null;
Socket socket = null;
try
{
// Create Key
KeyGenerator kg = KeyGenerator.getInstance("DES");
SecretKey secretKey = kg.generateKey();
// Create Cipher
Cipher desCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
desCipher.init(Cipher.ENCRYPT_MODE, secretKey);
socket = new Socket("localhost", 1450);
out = new ObjectOutputStream(socket.getOutputStream());
File file = new File("C:\Haroot\hfz.txt");
FileInputStream fileInputStream = new FileInputStream(file);
byte[] bytes = new byte[(int)file.length()];
fileInputStream.read(bytes);
fileInputStream.close();
byte[] encryptedBytes = new byte[(int)file.length()];
encryptedBytes = desCipher.doFinal(bytes);
out.writeInt((int)file.length());
out.writeObject((Object)secretKey);
out.write(encryptedBytes);
out.flush();
out.close();
}
catch(IOException e)
{
e.printStackTrace();
}
catch (NoSuchPaddingException e)
{
System.err.println("Padding problem: " + e);
}
catch (NoSuchAlgorithmException e)
{
System.err.println("Invalid algorithm: " + e);
}
catch (InvalidKeyException e)
{
System.err.println("Invalid key: " + e);
}
catch (IllegalBlockSizeException e)
{
System.err.println("IllegalBlockSizeException: " + e);
}
catch (BadPaddingException e)
{
System.err.println("BadPaddingException: " + e);
}
finally
{
try
{
socket.close();
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
}