-
Notifications
You must be signed in to change notification settings - Fork 36
Closed
Description
I have this certificate pem:
-----BEGIN CERTIFICATE-----
MIIBmzCCAU2gAwIBAgIUc3CP27MnVx981uEuHQs9S0Z2It4wBQYDK2VwMB8xHTAb
BgNVBAMMFEphbWl4aXIgRWQyNTUxOSBDZXJ0MB4XDTI0MTIyNDE3MjUxMFoXDTI1
MTIyNDE3MjUxMFowHzEdMBsGA1UEAwwUSmFtaXhpciBFZDI1NTE5IENlcnQwKjAF
BgMrZXADIQC+JYCer6m9jWCV9yaMajjDoxOgWtT/E6qLaEFQZpIh9KOBmjCBlzAd
BgNVHQ4EFgQUWH8zj4tUbhVp0ZD+RZGTxA+QgmEwHwYDVR0jBBgwFoAUWH8zj4tU
bhVp0ZD+RZGTxA+QgmEwDwYDVR0TAQH/BAUwAwEB/zBEBgNVHREEPTA7gjlleHlz
eWJodnB2ZzZ5MnlldjY0dGl5MnJ5eW9ycmhpYzIydDdyaGt1bG5iYXZhenVzZWgy
YT09PT0wBQYDK2VwA0EAbUo3/bFgAe7BeWPs+JchsArJoZDezTVJ7qvOfN4VRt5Z
Mx6+w2eb6BoaNkowZLRzIbMiTzNn5Ue7kA01E0r2BA==
-----END CERTIFICATE-----
Which results in this info:
~/dev/jamixir (networking)₿ openssl x509 -noout -text -in cert.pem
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
73:70:8f:db:b3:27:57:1f:7c:d6:e1:2e:1d:0b:3d:4b:46:76:22:de
Signature Algorithm: ED25519
Issuer: CN=Jamixir Ed25519 Cert
Validity
Not Before: Dec 24 17:25:10 2024 GMT
Not After : Dec 24 17:25:10 2025 GMT
Subject: CN=Jamixir Ed25519 Cert
Subject Public Key Info:
Public Key Algorithm: ED25519
ED25519 Public-Key:
pub:
be:25:80:9e:af:a9:bd:8d:60:95:f7:26:8c:6a:38:
c3:a3:13:a0:5a:d4:ff:13:aa:8b:68:41:50:66:92:
21:f4
X509v3 extensions:
X509v3 Subject Key Identifier:
58:7F:33:8F:8B:54:6E:15:69:D1:90:FE:45:91:93:C4:0F:90:82:61
X509v3 Authority Key Identifier:
58:7F:33:8F:8B:54:6E:15:69:D1:90:FE:45:91:93:C4:0F:90:82:61
X509v3 Basic Constraints: critical
CA:TRUE
X509v3 Subject Alternative Name:
DNS:exysybhvpvg6y2yev64tiy2ryyorrhic22t7rhkulnbavazuseh2a====
Signature Algorithm: ED25519
Signature Value:
6d:4a:37:fd:b1:60:01:ee:c1:79:63:ec:f8:97:21:b0:0a:c9:
a1:90:de:cd:35:49:ee:ab:ce:7c:de:15:46:de:59:33:1e:be:
c3:67:9b:e8:1a:1a:36:4a:30:64:b4:73:21:b3:22:4f:33:67:
e5:47:bb:90:0d:35:13:4a:f6:04
When I try to import it works:
{:ok, cert} = X509.Certificate.from_pem(File.read!("cert.pem"))
{:ok,
{:OTPCertificate,
{:OTPTBSCertificate, :v3, 659044153923839650366784781981133796981832295134,
{:SignatureAlgorithm, {1, 3, 101, 112}, :asn1_NOVALUE},
{:rdnSequence,
[
[
{:AttributeTypeAndValue, {2, 5, 4, 3},
{:utf8String, "Jamixir Ed25519 Cert"}}
]
]},
{:Validity, {:utcTime, ~c"241224172510Z"}, {:utcTime, ~c"251224172510Z"}},
{:rdnSequence,
[
[
{:AttributeTypeAndValue, {2, 5, 4, 3},
{:utf8String, "Jamixir Ed25519 Cert"}}
]
]},
{:OTPSubjectPublicKeyInfo,
{:PublicKeyAlgorithm, {1, 3, 101, 112}, :asn1_NOVALUE},
{:ECPoint,
<<190, 37, 128, 158, 175, 169, 189, 141, 96, 149, 247, 38, 140, 106, 56,
195, 163, 19, 160, 90, 212, 255, 19, 170, 139, 104, 65, 80, 102, 146, 33,
244>>}}, :asn1_NOVALUE, :asn1_NOVALUE,
[
{:Extension, {2, 5, 29, 14}, false,
<<88, 127, 51, 143, 139, 84, 110, 21, 105, 209, 144, 254, 69, 145, 147,
196, 15, 144, 130, 97>>},
{:Extension, {2, 5, 29, 35}, false,
{:AuthorityKeyIdentifier,
<<88, 127, 51, 143, 139, 84, 110, 21, 105, 209, 144, 254, 69, 145, 147,
196, 15, 144, 130, 97>>, :asn1_NOVALUE, :asn1_NOVALUE}},
{:Extension, {2, 5, 29, 19}, true,
{:BasicConstraints, true, :asn1_NOVALUE}},
{:Extension, {2, 5, 29, 17}, false,
[dNSName: ~c"exysybhvpvg6y2yev64tiy2ryyorrhic22t7rhkulnbavazuseh2a===="]}
]}, {:SignatureAlgorithm, {1, 3, 101, 112}, :asn1_NOVALUE},
<<109, 74, 55, 253, 177, 96, 1, 238, 193, 121, 99, 236, 248, 151, 33, 176, 10,
201, 161, 144, 222, 205, 53, 73, 238, 171, 206, 124, 222, 21, 70, 222, 89,
51, 30, 190, 195, 103, 155, 232, 26, 26, 54, 74, ...>>}}
But when I try to read the public key I get an error:
iex(32)> X509.Certificate.public_key(cert)
** (CaseClauseError) no case clause matching: {:PublicKeyAlgorithm, {1, 3, 101, 112}, :asn1_NOVALUE}
(x509 0.8.10) lib/x509/public_key.ex:139: X509.PublicKey.unwrap/1
iex:32: (file)
Metadata
Metadata
Assignees
Labels
No labels