Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for Support of Ed25519 and X25519 Keys in Flutter X509 Project #34

Open
thomnico opened this issue Aug 17, 2024 · 0 comments
Open

Comments

@thomnico
Copy link

I am writing to request the addition of support for Ed25519 and X25519 keys in the Flutter X509 project. These key types are supported in OpenSSL and are becoming increasingly important for modern cryptographic applications. However, it appears that the current implementation of the Flutter X509 library does not support these key types, leading to issues when parsing certificates that include them.
I need them to enable Yubikey PIV in flutter for macos and windows.

Problem: When attempting to parse X certificates that contain Ed25519 or X25519 keys, the following error is encountered:

Message: 3 positional arguments expected by 'X509Certificate.new', but 0 found.
Try adding the missing arguments.
Problematic code: )
Context:
Additionally, the following OIDs related to Ed25519 and X25519 keys fail during parsing:

Ed25519 OID: 1.3.101.112
X25519 OID: 1.3.101.110
Example Code: Here is a snippet of the code that encounters the issue:

Dart
Insert code

// Parsed the ASN. data
ASN1Sequence asn1Seq = ASN1Sequence.fromBytes(certRead);
dev.log("asn1seq to String : ${asn1Seq.toString()}");
X509Certificate myx509 = const X509Certificate();
var parser = ASN1Parser(certRead);
dev.log(
"TBSCert extensions list ${myx509.tbsCertificate.extensions.toString()}");
try {
var c = X509Certificate.fromAsn1(parser.nextObject() as ASN1Sequence);
// Further processing...
} catch (e) {
dev.log("Error parsing certificate: $e");
}
Example ASN1 SequenceHere is an example of an ASN1 sequence (values are faked for illustration purposes):

ASN1Sequence(
elements: [
ASN1Integer(value: 123456789),
ASN1Sequence(
elements: [
ASN1ObjectIdentifier(oid: '1.2.840.113549.1.1.11'),
ASN1Null()
]
),
ASN1Sequence(
elements: [
ASN1Set(
elements: [
ASN1Sequence(
elements: [
ASN1ObjectIdentifier(oid: '2.5.4.6'),
ASN1PrintableString(string: 'US')
]
),
ASN1Sequence(
elements: [
ASN1ObjectIdentifier(oid: '2.5.4.10'),
ASN1PrintableString(stringValue: 'Example Corp')
]
)
]
)
]
),
ASN1Sequence(
elements: [
ASN1ObjectIdentifier(oid: '1.3.101.110'), // X25519 OID
ASN1OctetString(octets: Uint8List.fromList([0x01, 0x02, 0x03, 0x04]))
]
),
ASNSequence(
elements: [
ASN1ObjectIdentifier(oid: '1.3.101.112'), // Ed25519 OID
ASN1OctetString(octets: Uint8List.fromList([0x05, 0x06, 0x07, 0x08]))
]
)
]
)
Request: I kindly request that support for Ed25519 and X25519 keys be added to the Flutter X509 library. This would involve recognizing the OIDs for these key types and correctly parsing the associated extensions.

Additional Information:

Ed25519 OID:1.3.101.112
X25519 OID: 1.3.101.110
Thank you for your attention to this matter. Adding support for these key types would greatly enhance the utility of the Flutter X509 library for modern cryptographic applications.

Best regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant