Ajutor parsare certificate in PHP

security
php
x509

(Andrei Neamțu) #1

Imi bat capul cu o problema de ceva vreme.
Incerc sa folosesc un certificat primit intr-un XML dar indiferent sub ce forma incerc sa il pun, nu mi-l vede ca certificat valid.

Certificatele de aici sunt oricum pentru teste, nu e nimic secret.

Certificatul vine sub forma:

<credential id="ABRP:11000703613_22600600" credentialType="U" credentialSalt="1KQNMLiCG50rlmmxZZjJN3nYbWs=" integrityValue="zpghf19iEvL3eaYrJnGTg9MQR5g=">
      <name1>Heathers</name1>
      <name2>Byrne and Miller</name2>
      <abn>11000703613</abn>
      <legalName>Jekode P/L</legalName>
      <personId>22600600</personId>
      <serialNumber>155648</serialNumber>
      <creationDate>2017-03-01T14:27:00</creationDate>
      <notBefore>2017-03-01T14:27:28+11:00</notBefore>
      <notAfter>2019-03-01T14:27:28+11:00</notAfter>
      <sha1fingerprint>FnByhC/uiwW/8wq6pZlVIjmEuHY=</sha1fingerprint>
      <publicCertificate>MIIRKwYJKoZIhvcNAQcCoIIRHDCCERgCAQExADALBgkqhkiG9w0BBwGgghEAMIIEJjCCAw6gAwIBAgIDAmAAMA0GCSqGSIb3DQEBCwUAMIGFMQswCQYDVQQGEwJBVTElMCMGA1UEChMcQXVzdHJhbGlhbiBCdXNpbmVzcyBSZWdpc3RlcjEgMB4GA1UECxMXQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxLTArBgNVBAMTJFRlc3QgQXVzdHJhbGlhbiBCdXNpbmVzcyBSZWdpc3RlciBDQTAeFw0xNzAzMDEwMzI3MjhaFw0xOTAzMDEwMzI3MjhaMFoxETAPBgNVBC4TCDIyNjAwNjAwMQswCQYDVQQGEwJBVTEUMBIGA1UEChMLMTEwMDA3MDM2MTMxIjAgBgNVBAMTGUhlYXRoZXJzIEJ5cm5lIGFuZCBNaWxsZXIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKHsQp+VgzPGORui6JAm03gwK3nLU4OOVDRsvhzPw4ldS/ca1BoF7/Dmh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xAA==</publicCertificate>
      <protectedPrivateKey>MIICrjAoBgoqhkiG9w0BDAEDMBoEFNSkDTC4ghudK5ZpsWWYyTd52G1rAgIEAASCAoAFYGVfq9w9mifxWOzbA+s8SUT3LXcF7mK4NvJd108TDSyGRGnSxquij2F85VunSK445nGimzeAZk8qqdoUAhCA8EmsEUgxRUXUQhPRbGD2zY1pkWRoRhdyzo46Qy3DstG3oKJGOXvASI+aCWdE/Rk1lsAeUymkumrYnXWOEZZJ4j+EsuvnQn6jDmiJwQegXAxJRM4PfbB7nED5k6r4Lg+fPSxz8/EjKssYpfHrSbzzjP3RwsofibYYBY+iSwvcEeOVkZGuDP/6gZnN6vlC4VTAbijvTNzRCkvaVO6ag0qx61uGdTHDw0j04zYnOMnKjRq33wkU9mBH/XsscJooWbZRk0VFXMn1f6hS591bVCGNW3cdWO6M0c8WmArR/jh8s4q3W6FvFrj/xaqUYFUfKXawbMdBrGTFuz9Gr1J/ZPGnSwE9vfORRrMHbdjBxO4vYXKKHPuIoZcYma4UCc6qOLH2TefqpSoZxH13iEPC1U8dPHSkxd5VentvwHOaPp2zd7czMcdA1AQZV8CDCfRlwBzZiqETVcpuTrptG8q4p1BlX/7MozTmj5D9YR4mQaHsH2cuPFaCSVnvI6r78dfSxINwR9BmMp5bTVVp6GpnKHFa5NIyWsr1W972TnYdpMV2uXkaOQjhlRalbf5LyDJCzA+8jBtX3bhHn8W6GaMmCKXdxqgDDrNV7Z7m/n0U672vx3CYtGN6je8LJwJnJmhwz6e80Qm+jXqHXX8UxGf8IFx6/VwzoGqLhwzzYtIDsdlCb1AguYgAdKtVOtnuIKXivc5P4OI8f4DWfacX9eI2/WjehriavwDGzYKztOVtlEAHjFKLjifwC9fSHb5Audeel3do</protectedPrivateKey>
    </credential>

Am incercat sa iau public certificate, sa ii dau split la 64 de caractere, sa ii trec -----BEGIN CERTIFICATE----- si -----END CERTIFICATE----- dar degeaba. OpenSSL nu il poate citi, nu este format ok, etc.

Singura modalitate prin care am reusit sa generez ceva a fost sa dau base64_decode la string, sa il salvez cu extensia CER si sa il incarc in OSX KeyChain iar de acolo sa ii dau export in PEM.

Am nevoie sa il pot citi cu tot cu private key in PHP. Orice ajutor este bine venit.


(István F.) #2

Problema ta e clara, certificatele au mai multe linii, nu le poti reprezenta in XML doar printr-o linie fara conversie.

O solutie intradevar este sa faci base64_encode si base64_decode. (din cate inteleg tu le ai codate in base64 deja)

Eu as separa XML-ul in mai multe parti :

cheia privata :

<RSAKeyValue>
  <Modulus>AKoYq6Q7UN7vOFmPr4fSq2NORXHBMKm8p7h4JnQU+quLRxvYll9cn8OBhIXq9SnCYkbzBVBkqN4ZyMM4vlSWy66wWdwLNYFDtEo1RJ6yZBExIaRVvX/eP6yRnpS1b7m7T2Uc2yPq1DnWzVI+sIGR51s1/ROnQZswkPJHh71PThln</Modulus>
  <Exponent>AQAB</Exponent>
  <P>AN4DDp+IhBca6QEjh4xlm3iexzLajXYrJid6vdWmh4T42nar5nem8Ax39o3ND9b1Zoj41F9zFQmuZ8/AgabreKU=</P>
  <Q>AMQi+R0G9m0K+AcqK3DFpv4RD9jGc0Tle98heNYT7EQvZuuiq4XjvRz0ybqN//bOafrKhsTpRS9DQ7eEpKLI4Bs=</Q>
  <DP>FklyR1uZ/wPJjj611cdBcztlPdqoxssQGnh85BzCj/u3WqBpE2vjvyyvyI5kX6zk7S0ljKtt2jny2+00VsBerQ==</DP>
  <DQ>AJGC1Mg5Oydo5NwD6BiROrPxGo2bpTbu/fhrT8ebHkTz2eplU9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhM=</DQ>
  <InverseQ>EaiK5KhKNp9SFXuLVwQalvzyHk0FhnNZcZnfuwnlCxb6wnKg117fEfy91eHNTt5PzYPpf+xzD1FnP7/qsIninQ==</InverseQ>
  <D>Fijko56+qGyN8M0RVyaRAXz++xTqHBLh3tx4VgMtrQ+WEgCjhoTwo23KMBAuJGSYnRmoBZM3lMfTKevIkAidPExvYCdm5dYq3XToLkkLv5L2pIIVOFMDG+KESnAFV7l2c+cnzRMW0+b6f8mR1CJzZuxVLL6Q02fvLi55/mbSYxE=</D>
</RSAKeyValue>

si

cheia publica :

<RSAKeyValue>
  <Modulus>AKoYq6Q7UN7vOFmPr4fSq2NORXHBMKm8p7h4JnQU+quLRxvYll9cn8OBhIXq9SnCYkbzBVBkqN4ZyMM4vlSWy66wWdwLNYFDtEo1RJ6yZBExIaRVvX/eP6yRnpS1b7m7T2Uc2yPq1DnWzVI+sIGR51s1/ROnQZswkPJHh71PThln</Modulus>
  <Exponent>AQAB</Exponent>
</RSAKeyValue>

http://phpseclib.sourceforge.net/rsa/examples.html#public,openssh


(Andrei Neamțu) #3

Nu stiu cum ai ajuns tu la forma aia :slight_smile:

Ti-am zis, daca ii fac base64_decode si encode nu rezolv nimic. Nu pot citi.
Din ce am vazut eu prin SDK-ul lor, au o librarie sub forma de dll care parseaza certificatul si apare ceva cu PCKS#7. Inca nu am reusit sa decodez chestia asta.


(István F.) #4

Ai dreptate n-am citit de tot,
Am incercat si eu sa fac base64_decode la ce ai pus si nu da nimic util. Deci presupun ca e ceva format proprietar cu un charset ciudat.

0+	*H
a010	*H
a0&0`0
	*H
010	UAU1%0#U
Australian Business Register1 0UCertification Authority1-0+U$Test Australian Business Register CA0
170301032728Z
190301032728Z0Z10U.2260060010	UAU10U
110007036131"0 UHeathers Byrne and Miller00
	*H
0B39e&x0+yST4lÉ]KAJ	%ɩWRcNX䏚co*דay.-Ҳ︨e>_j쏇1bI`(y1J)`FEK0G0U00U 00	*$9ea00+a0This certificate may only be used for the purpose permitted in the applicable Certificate Policy. Limited liability applies - refer to the Certificate Policy.0+awww.testabrca.com0*$M
110007036130U0U#0%'_qwb,vZ0
	*H
4vCDi=(O'JSQ]ڍjs?d1-8U"<4*~p%:IQk
fr^$|n7qHn2)AϊnOD2!ro|NSdD{<D:\	1wJc?Jf)es9/?bֈ2CXq𭤩F7|Ja{IЈ;%400͠0
	*H
010	UAU1%0#U
Australian Business Register1 0UCertification Authority1200U)Test Australian Business Register Root CA0
090420020611Z
190420020611Z010	UAU1%0#U
Australian Business Register1 0UCertification Authority1-0+U$Test Australian Business Register CA0"0
	*H
0
kqfeaLonx؋(f>z)dsY f9MVӠrfKoU~i͎z}Zcӿ1u5Y*Zl`ԹW:=܊8GY"ZNgZSmGm;n7"kuAu@^ti;LeH#zH:ue6YFqsζ
I`v	[}]`y:2ܴ**O0v]LW0S0U00U 00	*$9e00+a0This certificate may only be used for the purpose permitted in the applicable Certificate Policy. Limited liability applies - refer to the Certificate Policy.0+awww.testabrca.com0U0U#03};NnQCFG0U%'_qwb,vZ0
	*H
ܰGT>Gsk=̲jg8Cez@协XU)sŲpK<O3Br]t/ti/wr"\CFvYෆLB*V
;`y9ϯ8l@a,J2Ӊjk<Ό*KHg`Ah,߶MxI~38^8҄wBY!0e\ 	\M=|]O/Q(aAQ3nK<P|```iYgꎨu/vW17K?ڴ]j{LHV'`d);`kI[RQOAGpɢozPwA.M@Yu d(bٍۯo)0{qkiJ,9Ebn)'9ƁߪQM`oS?TV엨MkI5weVl7
m05&e_ܝI9jdB^Bd?00Ѡ0
	*H

010	UAU1%0#U
Australian Business Register1 0UCertification Authority1200U)Test Australian Business Register Root CA0
090420011754Z
290420011754Z010	UAU1%0#U
Australian Business Register1 0UCertification Authority1200U)Test Australian Business Register Root CA0"0
	*H
0
<l?	S=x(^ƯU dxE7N-7y/P7F\kv@1Ջ'tƟ߁@f[/736ʑa#Y4_ڔďYR<#Pbje.V܉~UE8gjv%@҇*w!,ʵ"]KՔaY$.9VYqJ`b^l3-bp:1g5b9x3XQJjF~wcUA|lSlx~r
ee_uqFv ~YQ'GX
K뤉xCF#Zz&CZ&ai//=iϫM/955` $\='eGICï+=WJu9)#z?N^,"R)
lཱྀ	{Y13DaWK"gѾV0R0U00U 00*$9e00+a0This certificate may only be used for the purposes permitted in the applicable Certificate Policy. Limited liability applies - refer to the Certificate Policy 0+awww.testsbrroot.com0U0U#03};NnQCFG0U3};NnQCFG0
	*H

%3ZbHL@֎+3]Tw܅	%
F!L֮t:GDkxcR7Gdcs܁A]TQ4̆RIF1^,E!`N?%,Qྪsn^{t_.ӇF8G}{ؗ-$vKAH	+cS1I[5^)?\>ai̅1mݪ"N!?ك^2r,.'R UMХK
}֗j-jzq+O;Y\qٿfa$R|à[[Z	x6N+fQp{@~KbiZn)yjn_	a'xxoΦ.eMFfoNe\<t~	L${1}>!Χƴ
fedouS(p%UՑ:Ҍg ,G1

(Andrei Neamțu) #5

Daca import decodeul ala in KeyChain in OSX cumva imi citeste certificatul. Dar nu stiu cum sa fac sa il citesc si eu :slight_smile:


(Opencart Romania) #6

Saluty!

Doar XML?? hmm
In caz contrar cred ca asta era util:

http://phpseclib.sourceforge.net/x509/decoder.php

sau varianta openssh

Spor


(István F.) #7

Gata. am dat de ce trebuie.

https://decoder.link/result

E o cheie PCKS#7 si se decodeaza cu PCKS#7 sau base64_decode -> PCKS#7


(Andrei Neamțu) #8

Super tare. Trebuie sa vad exact cum fac asta in php. Stiu ca am incercat si eu cu openssl sa convertesc in PEM sa o pot citi cu php-ul. I’ll keep searching. Multumesc mult :slight_smile:


(Opencart Romania) #9

Saluty!

Pai de ce nu ai spus in ce limbaj doresti sa faci acest lucru?
*banuiesc ca .NET (C sau C++)…?
Spor


(Andrei Neamțu) #10

Scrie si in titlu, PHP. Am mentionat si in mesaj.


(Opencart Romania) #11

Eram adomit!

Scuze…


(Andrei Neamțu) #12

Revin cu o problema conexa. Cu certificatul am rezolvat. Am o problema cu private key-ul.

Incerc sa il incarc cu

$key = openssl_pkey_get_private(file_get_contents('ato.key'), 'Password1!');

Problema e ca imi da false de fiecare data. E posibil sa fie encrypted dar nu stiu cu ce sau cum.
Cumva, cu un site, am confirmat ca aceasta cheie se potriveste la certificat.

-----BEGIN PRIVATE KEY-----
MIICrjAoBgoqhkiG9w0BDAEDMBoEFNSkDTC4ghudK5ZpsWWYyTd52G1rAgIEAASC
AoBKrtlfoxovaFyMNO66ABxDZaNvhKK5ZkO61D2BGTerpEPhJ5v8ObddYs/ZYt8S
OOjEO3ubyBvjvDrRGmLxTGaicZeHWGOjp3dPY4JUA+eKVaNAXolu9mnZxwL9e8u/
UCoAOEZ3ufohY8IgjdgfXSUKyaCJ3vQhmkjWntF5Ufm6l72yRa52ixKRTdPAERBa
ijETUTnw4MtzDalMHUxKQaobU4hklrtGvAd0k8CcN1KRO8ptHDPrT8anDT4f7gY/
h5KLqGSXw1D6VAFUmC1tvabYKe5+aDlXHO8YfwAbC4ZM4en3Kpja89I1fEOJAW8f
Py/VFzy8gfoBV6pae+XXzKBY8J8NLtI766KlkX05DHFbmccOcjt4s4ZX+nXyyYTt
KhK0Hni9EH6vxr6xbSW6H4AqiqgvZJ3uBOpk1mu9/KogvsQNfCfCOsJXO+FTn1pb
rfhKiJQE/mWrqwOwEgjA4wxZaFufktYwLZ7saDziM4M6fVyKSK0VO0HCOmyauQlN
qER8WEtAY2ubg3hBXTzg3Mtuqm3cgX6gzkAL7DgpGTg+ByCWsMlJtulwU3e58nEC
JUJGzqcL5gzN3dmbvWvx1tzWik+Qbn8QmHUS0bZI0er/G3v8K+ZBsTTgtMDXrGCK
vcvJp2c70xGzrPIW65Fxb/Bq4R2kWkL/28fQvQz1Yj7F4esRmZJdfjFyxiWV5Xnr
8HVGzfJarqmWSfLSwnYq94LhydPYBzVePb6kStz0A/aevLR4g87YWTXWLKnUusxX
dUkZbplJsD0mOwFjaxUf/r9OLUfu17zMyOiInS+OVZS6bU6N26ZjDw0vAHbEG7Ox
XvG6w2r5m+CUPVPH9nQmMaI4
-----END PRIVATE KEY-----

Nu prea stiu cum sa fac decryptul. Incercand sa ma uit in libraria de Java gasesc niste referinte la o suita de cryptografie BouncyCastle si ca s-ar face un decoding din ceva PBES, PKCS5. I have no idea.