Comments (16)
i found that's my mis understanding. just use TEd25519Signer and TEd25519PublicKeyParameters get public key from remote site.
than verify is correct
from cryptolib4pascal.
here are test samples for ED25519
please do ensure you are using the correct specification as there are many variations that use different hashes too.
from cryptolib4pascal.
i had read your test sample, but none of them same as SSH usage.
i dump and make a test code below:
//----------
s:='0D272BAD5D29C8ECE802C3B9D8A2C43EE341F6130CD93B5FD7E9124FFC2F9348';
remotePubKey:=THex.Decode(s);
edinstance:=TEd25519.Create;
edsigner:=TEd25519Signer.Create(edinstance);
pubkey:=TEd25519PublicKeyParameters.Create(remotePubKey,0);
edsigner.Init(false,pubkey);
//remote signature
s:='6AA8F2B39DF94A767BE445B615DCB7BF8F8BDF09137F8D825858454F79202C7781CB1F40320509ED575F89E6AF5E37DC33F8C0D70AA4C8E0A9AA1CB463C9730C';
remotesig:=THex.Decode(s);
if not edsigner.VerifySignature(remotesig) then
begin
writeln(stdout,'ed25519 Verify fail');
end;
//----------
from SSH Spec,
Signatures are encoded as follows:
mpint r
mpint s
and
get from PUTTY: Verify that sG == r + HpublicKey
where H = eddsa_signing_exponent_from_data( extra, r, HASH VALUE CALC FROM PROTOCOL);
that all infor what i got
from cryptolib4pascal.
you will need to do more than just dumping some values here.
where is the specs defined?
what hash is used for the ssh ed25519 implementation in putty?
these are the information you need to provide if I am going to be able to help you.
from cryptolib4pascal.
i check my dump
the exchange_hash:
A7FB2B3C5B81C02BBABA58EA7B3A0537A0A6C54EF3F61A49E4A12D45B59C0CC5
from cryptolib4pascal.
the length of the hash you just provided means it is a 32 byte hash.
now there are various hashes that their output are 32 bytes in length.
how do we know which putty uses?
that is why I am asking if there is any specs document that putty provides that we can use to understand what they do exactly.
from cryptolib4pascal.
HASH2-256
from cryptolib4pascal.
any other details?
from cryptolib4pascal.
from SSH Spec , i get
https://tools.ietf.org/html/rfc8709
AND verification algo from https://tools.ietf.org/html/rfc8032#section-5.1.7
from cryptolib4pascal.
can you share the private key and message been signed?
from cryptolib4pascal.
PUTTY Private Key:
length of int 32
E0712AD341699FDCFDC490963F652BC2B758A8E0D3F900400E44A11B64214046
and the code part of PUTTY that verify
EdwardsPoint r = eddsa_decode(rstr, ek->curve);
mp_int s = mp_from_bytes_le(sstr);
mp_int H = eddsa_signing_exponent_from_data(ek, extra, rstr, data); //<--- exchange_hash = data
/ Verify that sG == r + HpublicKey */
EdwardsPoint *lhs = ecc_edwards_multiply(ek->curve->e.G, s);
EdwardsPoint *hpk = ecc_edwards_multiply(ek->publicKey, H);
EdwardsPoint *rhs = ecc_edwards_add(r, hpk);
unsigned valid = ecc_edwards_eq(lhs, rhs);
from cryptolib4pascal.
from https://tools.ietf.org/html/rfc8032#section-5.1.7
it looks like your ClpEd25519.implverify()
but your s need 64 bytes.
from cryptolib4pascal.
i found there is an miss from me
-
PUBLIC KEY IS : 3AA337590966B82B63AB241AA5464FF2477A8651B9396744EDFC214284CDA5B4
exchange_hash: A7FB2B3C5B81C02BBABA58EA7B3A0537A0A6C54EF3F61A49E4A12D45B59C0CC5
remotesig: 6AA8F2B39DF94A767BE445B615DCB7BF8F8BDF09137F8D825858454F79202C7781CB1F40320509ED575F89E6AF5E37DC33F8C0D70AA4C8E0A9AA1CB463C9730C; -
by calling ClpEd25519.implverify(), no matter phflag=0 or phflag=1 and ctx just generate like your high level test.
the result was fail . -
ClpEd25519.implverify() call EncodePoint(pR, check, 0); twice
-
failed because of TArrayUtils.ConstantTimeAreEqual(check, r) return false;
from cryptolib4pascal.
still trying to figure out why your input data are not verifying.
we must be missing something related to the input.
from cryptolib4pascal.
i got from http://ed25519.herokuapp.com/
Private Key:
n0htabTRTpckjTd8tQqPvN/Pr5J5uZSGGiK12Z1ucqxopyoZ1aRoRknWAud+PZfrl/CTquyYGXld6H5aS09p4g==
Public Key:
aKcqGdWkaEZJ1gLnfj2X65fwk6rsmBl5Xeh+WktPaeI=
Message: (Text to be signed or verified)
testing
Signature:
2xh3zLhpi+TGSXESwe7ff17QaaGCiwasJFG25GrgfqvTf1BwYIX4qEyIdriLarTXvTcKLIKzxdVzctKbdKudCA==
and write test code
qb:=TBase64.Decode('aKcqGdWkaEZJ1gLnfj2X65fwk6rsmBl5Xeh+WktPaeI='); hexstring:=TBase64.Decode('2xh3zLhpi+TGSXESwe7ff17QaaGCiwasJFG25GrgfqvTf1BwYIX4qEyIdriLarTXvTcKLIKzxdVzctKbdKudCA=='); h:=TEncoding.ASCII.GetAnsiBytes('testing'); if not edinstance.implverify(hexstring,0,qb,0,LCtx,1,h,0,length(h)) then begin writeln(stdout,'ed25519 Verify fail'); exit(-2); end;
but still fail, i just confuse, did i make wrong LCtx? or ?
from cryptolib4pascal.
glad you have resolved your issue and thanks for the feedback.
closing this ticket for now.
from cryptolib4pascal.
Related Issues (20)
- SSH ECDH problem HOT 6
- GE HOT 2
- Keypair generation and sign/verify using ECDSA + sha1 HOT 2
- Simple examples of usage. HOT 1
- Lazarus form examples? HOT 10
- Installer HOT 1
- Example with CryptoJS AES HOT 1
- Circular unit reference to 'ClpBigInteger' HOT 4
- Cryptographically-secure pseudorandom number generator - CPRNG HOT 2
- SHA256WITHDSA verify problem HOT 2
- Access violation in rtl270.bpl HOT 2
- Convert mnemonic to adresses
- Several compilation errors HOT 20
- Test Project does compile (Delphi) HOT 9
- Using this in RAD Studio 11 HOT 1
- I can't find aes/gcm/nopadding ? I searched whole internet and can;t find anything. HOT 1
- HMAC-SHA256 help needed HOT 3
- Error TECPrivateKeyParameters create 'Scalar is not in the interval[1, n-1]' HOT 5
- trying to use AES/ECB/PKCS7PADDING HOT 3
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.
from cryptolib4pascal.