Come posso ottenere i parametri delle curve ellittiche da un host?

0

Ad esempio, con openssl ho visto che facebook funziona con la curva ellittica ANSI X9.62 prime256v1 e quello che voglio è il punto della curva che sta usando con la mia firma. Ho visto che posso estrarre il punto dal certificato di Facebook, nella chiave pubblica.

Quindi di nuovo con openssl ottengo la chiave pubblica:

-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEoPGMr6c5iGhbE1YOFRW0p0XvG8fl
hTwrBNRlijExIuqjku1knbplgeO2EnbYswtF8f8KKBScT9xzqbNJLaB20w==
-----END PUBLIC KEY-----

Ma ora non so come ottenerlo. Qualcuno sa come farlo? O sto sbagliando? Posso fare operazioni con Sage.

Grazie

    
posta Roger Coll Aumatell 05.01.2018 - 11:40
fonte

1 risposta

1

Non sei sicuro, ma questo è ciò che stai cercando?

$ cat pubkey.pub
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEoPGMr6c5iGhbE1YOFRW0p0XvG8fl
hTwrBNRlijExIuqjku1knbplgeO2EnbYswtF8f8KKBScT9xzqbNJLaB20w==
-----END PUBLIC KEY-----

$ openssl ec -pubin -in pubkey.pub -noout -text
read EC key
Private-Key: (256 bit)
pub:
    04:a0:f1:8c:af:a7:39:88:68:5b:13:56:0e:15:15:
    b4:a7:45:ef:1b:c7:e5:85:3c:2b:04:d4:65:8a:31:
    31:22:ea:a3:92:ed:64:9d:ba:65:81:e3:b6:12:76:
    d8:b3:0b:45:f1:ff:0a:28:14:9c:4f:dc:73:a9:b3:
    49:2d:a0:76:d3
ASN1 OID: prime256v1
NIST CURVE: P-256

$ openssl ec -pubin -in pubkey.pub -noout -text -param_enc explicit
read EC key
Private-Key: (256 bit)
pub:
    04:a0:f1:8c:af:a7:39:88:68:5b:13:56:0e:15:15:
    b4:a7:45:ef:1b:c7:e5:85:3c:2b:04:d4:65:8a:31:
    31:22:ea:a3:92:ed:64:9d:ba:65:81:e3:b6:12:76:
    d8:b3:0b:45:f1:ff:0a:28:14:9c:4f:dc:73:a9:b3:
    49:2d:a0:76:d3
Field Type: prime-field
Prime:
    00:ff:ff:ff:ff:00:00:00:01:00:00:00:00:00:00:
    00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:
    ff:ff:ff
A:
    00:ff:ff:ff:ff:00:00:00:01:00:00:00:00:00:00:
    00:00:00:00:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:
    ff:ff:fc
B:
    5a:c6:35:d8:aa:3a:93:e7:b3:eb:bd:55:76:98:86:
    bc:65:1d:06:b0:cc:53:b0:f6:3b:ce:3c:3e:27:d2:
    60:4b
Generator (uncompressed):
    04:6b:17:d1:f2:e1:2c:42:47:f8:bc:e6:e5:63:a4:
    40:f2:77:03:7d:81:2d:eb:33:a0:f4:a1:39:45:d8:
    98:c2:96:4f:e3:42:e2:fe:1a:7f:9b:8e:e7:eb:4a:
    7c:0f:9e:16:2b:ce:33:57:6b:31:5e:ce:cb:b6:40:
    68:37:bf:51:f5
Order:
    00:ff:ff:ff:ff:00:00:00:00:ff:ff:ff:ff:ff:ff:
    ff:ff:bc:e6:fa:ad:a7:17:9e:84:f3:b9:ca:c2:fc:
    63:25:51
Cofactor:  1 (0x1)
Seed:
    c4:9d:36:08:86:e7:04:93:6a:66:78:e1:13:9d:26:
    b7:81:9f:7e:90

$ openssl asn1parse -in pubkey.pub -i -dump
    0:d=0  hl=2 l=  89 cons: SEQUENCE
    2:d=1  hl=2 l=  19 cons:  SEQUENCE
    4:d=2  hl=2 l=   7 prim:   OBJECT            :id-ecPublicKey
   13:d=2  hl=2 l=   8 prim:   OBJECT            :prime256v1
   23:d=1  hl=2 l=  66 prim:  BIT STRING
      0000 - 00 04 a0 f1 8c af a7 39-88 68 5b 13 56 0e 15 15   .......9.h[.V...
      0010 - b4 a7 45 ef 1b c7 e5 85-3c 2b 04 d4 65 8a 31 31   ..E.....<+..e.11
      0020 - 22 ea a3 92 ed 64 9d ba-65 81 e3 b6 12 76 d8 b3   "....d..e....v..
      0030 - 0b 45 f1 ff 0a 28 14 9c-4f dc 73 a9 b3 49 2d a0   .E...(..O.s..I-.
      0040 - 76 d3                                             v.
    
risposta data 05.01.2018 - 11:51
fonte

Leggi altre domande sui tag