Skip to content

Possible to provide certificate at runtime? #146

Open
@erulabs

Description

@erulabs

Is it possible to provide a certificate at runtime? I have the certificate's pubkey at runtime, but do not know it during build time. The use-case is talking to a local hardware device in each users local network over HTTPS with a self-signed certificate.

An example:

      fetch('https://my-mdns-local-service.local', {
        sslPinning: { certs: [`sha256/PUBKEY-GOES-HERE`] },
      })

where PUBKEY-GOES-HERE is the output of ... | openssl dgst -sha256 -binary | openssl enc -base64 from the docs. It appears I need to have the cer file bundled in the app ahead of time. Is this possible or is this unsupported behavior? As an analog, you can do this sort of certificate verification with curl like curl --cacert cert.crt https://....

Thanks very much for this library by the way, appreciate it!!

Edit, after digging a bit more, https://github.com/MaxToyberman/react-native-ssl-pinning/blob/master/ios/RNSslPinning/RNSslPinning.m#L231 makes me think that no, this is not supported. It seems like I would need another option to pass my own custom list to certificatesInBundle in [AFSecurityPolicy certificatesInBundle:.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions