-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Use OkHttp's certificate creation code #6152
Conversation
We don't implement the full feature set that Bouncycastle has, but we also don't need it. In follow up changes I intend to remove the Bouncycastle dependency for everything but some test cases.
39f46f7
to
2e41bd7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. Impressive. Going to review more by attempting to use and debug a bit. But this is awesome.
val extensionValue = altNames.map { | ||
when { | ||
it.canParseAsIpAddress() -> { | ||
generalNameIpAddress to InetAddress.getByName(it).address.toByteString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this known to be expanded to the full form always for IPv6?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. The result will always be 4 or 16 bytes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff. Kudos.
val subjectPublicKeyInfo = CertificateAdapters.subjectPublicKeyInfo.fromDer( | ||
subjectKeyPair.public.encoded.toByteString() | ||
) | ||
val subject: List<List<AttributeTypeAndValue>> = subject() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woof
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐶
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of the explicit type spec? I don’t speak dog
private fun subject(): List<List<AttributeTypeAndValue>> { | ||
val result = mutableListOf<List<AttributeTypeAndValue>>() | ||
|
||
if (ou != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no better name for those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be organizationalUnitName. Follow-up!
We don't implement the full feature set that Bouncycastle has, but
we also don't need it.
In follow up changes I intend to remove the Bouncycastle dependency
for everything but some test cases.