dsa

Not implemented yet: DSA public key

谁说我不能喝 提交于 2019-12-08 10:26:18
问题 I'm writing both a server and an Android client application. The Android client sends measurements to the server. In order to ensure the data integrity, a digital signature is appended to each measurement. Since I need everything to be Gson-compatible, storing the public key itself is not possible. I'm storing the G, P, Q and Y factors instead. Here's a snippet from the request class: public PublicKey getPublicKey() { try { DSAPublicKeySpec keySpec = new DSAPublicKeySpec(publicKeyY,

M2Crypto: verifying DSA signatures

你说的曾经没有我的故事 提交于 2019-12-07 22:53:23
问题 I'm having trouble verifying DSA signatures using Python/M2Crypto. The signatures are generated in Java, using standard java.security.Signature class, with Sun's crypto provider and SHA1withDSA algorithm designation. Here's some shell output: >>> pk <M2Crypto.DSA.DSA_pub instance at 0x20b6a28> >>> sig = '302c02141c4bbb218215ebfec57288059ce814dc430d849502144dd0c581bf2213aff79d17eb37c939e120a97bd2'.decode('hex') >>> data ='0501...9794'.decode('hex') >>> pk.verify_asn1(sig, data) ---------------

How to work with OPENSSH PRIVATE KEY in Java?

梦想与她 提交于 2019-12-07 17:33:37
问题 I am generating a DSA key with the below command: ssh-keygen -t dsa Then I try to sign data using bouncycastle API like that: KeyFactory keyFactory = KeyFactory.getInstance("DSA"); String privateKeyContent = // the content of the generated file //init privateKey byte[] pemContent = null; PEMParser pemParser = new PEMParser(new StringReader(privateKeyContent)); Object pemObject = pemParser.readObject(); // throws And getting this exception java.io.IOException: unrecognised object: OPENSSH

Modular Exponentiation in Java

假如想象 提交于 2019-12-07 06:33:29
问题 I need a way to calculate: (g^u * y^v) mod p in Java. I've found this algorithm for calculating (g^u) mod p: int modulo(int a,int b,int c) { long x=1 long y=a; while(b > 0){ if(b%2 == 1){ x=(x*y)%c; } y = (y*y)%c; // squaring the base b /= 2; } return (int) x%c; } and it works great, but I can't seem to find a way to do this for (g^u * y^v) mod p as my math skills are lackluster. To put it in context, it's for a java implementation of a "reduced" DSA - the verifying part requires this to be

Using openssl to generate a DSA key pair

好久不见. 提交于 2019-12-06 09:23:41
问题 I want to generate a private and public key using C to use them in an authentication process. Can you please give me a basic example to generate the keys in C? I've found these functions but i don't how to use them: DSA * DSA_generate_parameters(int bits, unsigned char *seed, int seed_len, int *counter_ret, unsigned long *h_ret, void (*callback)(int, int, void *), void *cb_arg); int DSA_generate_key(DSA *dsa); Help me please! Thank you! :) 回答1: Can you please give me a basic example to

M2Crypto: verifying DSA signatures

泪湿孤枕 提交于 2019-12-06 08:29:37
I'm having trouble verifying DSA signatures using Python/M2Crypto. The signatures are generated in Java, using standard java.security.Signature class, with Sun's crypto provider and SHA1withDSA algorithm designation. Here's some shell output: >>> pk <M2Crypto.DSA.DSA_pub instance at 0x20b6a28> >>> sig = '302c02141c4bbb218215ebfec57288059ce814dc430d849502144dd0c581bf2213aff79d17eb37c939e120a97bd2'.decode('hex') >>> data ='0501...9794'.decode('hex') >>> pk.verify_asn1(sig, data) ------------------------------------------------------------ Traceback (most recent call last): ... DSAError: wrong

How to work with OPENSSH PRIVATE KEY in Java?

会有一股神秘感。 提交于 2019-12-06 03:53:44
I am generating a DSA key with the below command: ssh-keygen -t dsa Then I try to sign data using bouncycastle API like that: KeyFactory keyFactory = KeyFactory.getInstance("DSA"); String privateKeyContent = // the content of the generated file //init privateKey byte[] pemContent = null; PEMParser pemParser = new PEMParser(new StringReader(privateKeyContent)); Object pemObject = pemParser.readObject(); // throws And getting this exception java.io.IOException: unrecognised object: OPENSSH PRIVATE KEY So I have been trying to convert the key file to PEM, using this example, and executing: ssh

Modular Exponentiation in Java

狂风中的少年 提交于 2019-12-05 12:06:13
I need a way to calculate: (g^u * y^v) mod p in Java. I've found this algorithm for calculating (g^u) mod p: int modulo(int a,int b,int c) { long x=1 long y=a; while(b > 0){ if(b%2 == 1){ x=(x*y)%c; } y = (y*y)%c; // squaring the base b /= 2; } return (int) x%c; } and it works great, but I can't seem to find a way to do this for (g^u * y^v) mod p as my math skills are lackluster. To put it in context, it's for a java implementation of a "reduced" DSA - the verifying part requires this to be solved. Assuming that the two factors will not overflow, I believe you can simplify an expression like

ssh2_auth_pubkey_file authentication always fails

邮差的信 提交于 2019-12-04 18:07:23
问题 I'm trying to connect to another machine using PHP's ssh2 functions. I know the ssh keys have been created with no passwords and are distributed correctly, I can ssh user@host in the terminal on my machine to the server. The PHP function tries to connect to a ip address using an ssh key file:- function minnerConnect($miner_serial) { $port = '7822'; $miner_ip = $this->getMinerIp($miner_serial); $methods = array( 'kex' => 'diffie-hellman-group1-sha1', 'hostkey' => 'ssh-dss', 'client_to_server'

ssh2_auth_pubkey_file authentication always fails

て烟熏妆下的殇ゞ 提交于 2019-12-03 11:24:50
I'm trying to connect to another machine using PHP's ssh2 functions. I know the ssh keys have been created with no passwords and are distributed correctly, I can ssh user@host in the terminal on my machine to the server. The PHP function tries to connect to a ip address using an ssh key file:- function minnerConnect($miner_serial) { $port = '7822'; $miner_ip = $this->getMinerIp($miner_serial); $methods = array( 'kex' => 'diffie-hellman-group1-sha1', 'hostkey' => 'ssh-dss', 'client_to_server' => array( 'crypt' => '3des-cbc', 'mac' => 'hmac-md5', 'comp' => 'none'), 'server_to_client' => array(