Skip to content

OpenSSL to Java #250

Closed
Closed
@snyff

Description

@snyff

Hi team,

Following a discussion on twitter: https://twitter.com/headius/status/1503895505335726083

It would be great to be able to do:

key = OpenSSL::PKey::RSA.new(key).to_java(java.security.PrivateKey)
cert = OpenSSL::X509::Certificate.new(cert).to_java(javax.security.cert.X509Certificate)

instead of (similar-ish code):

private_key = Java::java.nio.file.Files.readAllBytes(Java::java.io.File.new("private.der").toPath());
keyFactory = Java::java.security.KeyFactory.getInstance("RSA");
keySpec = Java::java.security.spec.PKCS8EncodedKeySpec.new(private_key);
jprivate_key = keyFactory.generatePrivate(keySpec);
certificate = Java::java.nio.file.Files.readAllBytes(Java::java.io.File.new("cert.pem").toPath());
jcertificate = Java::javax.security.cert.X509Certificate.getInstance(certificate)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions