Package org.conscrypt

Class NativeCrypto

java.lang.Object
org.conscrypt.NativeCrypto

public final class NativeCrypto
extends Object
Provides the Java side of our JNI glue for OpenSSL.
  • Field Details

    • EC_CURVE_GFP

      public static final int EC_CURVE_GFP
      Used to request EC_GROUP_new_curve_GFp to EC_GROUP_new_curve
      See Also:
      Constant Field Values
    • EC_CURVE_GF2M

      public static final int EC_CURVE_GF2M
      Used to request EC_GROUP_new_curve_GF2m to EC_GROUP_new_curve
      See Also:
      Constant Field Values
    • OPENSSL_EC_NAMED_CURVE

      public static final int OPENSSL_EC_NAMED_CURVE
      EC_GROUP_set_asn1_flag: indicates an EC_GROUP is a NamedCurve.
      See Also:
      Constant Field Values
    • POINT_CONVERSION_COMPRESSED

      public static final int POINT_CONVERSION_COMPRESSED
      EC_GROUP_set_point_conversion_form: indicates compressed ASN.1 format
      See Also:
      Constant Field Values
    • POINT_CONVERSION_UNCOMPRESSED

      public static final int POINT_CONVERSION_UNCOMPRESSED
      EC_GROUP_set_point_conversion_form: indicates uncompressed ASN.1 format
      See Also:
      Constant Field Values
    • POINT_CONVERSION_HYBRID

      public static final int POINT_CONVERSION_HYBRID
      EC_GROUP_set_point_conversion_form: indicates hybrid ASN.1 format
      See Also:
      Constant Field Values
    • RAND_SEED_LENGTH_IN_BYTES

      public static final int RAND_SEED_LENGTH_IN_BYTES
      See Also:
      Constant Field Values
    • GN_STACK_SUBJECT_ALT_NAME

      public static final int GN_STACK_SUBJECT_ALT_NAME
      Used to request get_X509_GENERAL_NAME_stack get the "altname" field.
      See Also:
      Constant Field Values
    • GN_STACK_ISSUER_ALT_NAME

      public static final int GN_STACK_ISSUER_ALT_NAME
      Used to request get_X509_GENERAL_NAME_stack get the issuerAlternativeName extension.
      See Also:
      Constant Field Values
    • EXTENSION_TYPE_NON_CRITICAL

      public static final int EXTENSION_TYPE_NON_CRITICAL
      Used to request only non-critical types in get_X509*_ext_oids.
      See Also:
      Constant Field Values
    • EXTENSION_TYPE_CRITICAL

      public static final int EXTENSION_TYPE_CRITICAL
      Used to request only critical types in get_X509*_ext_oids.
      See Also:
      Constant Field Values
    • EXFLAG_CA

      public static final int EXFLAG_CA
      See Also:
      Constant Field Values
    • EXFLAG_CRITICAL

      public static final int EXFLAG_CRITICAL
      See Also:
      Constant Field Values
    • PKCS7_CERTS

      public static final int PKCS7_CERTS
      Used as the "which" field in d2i_PKCS7_bio and PEM_read_bio_PKCS7.
      See Also:
      Constant Field Values
    • PKCS7_CRLS

      public static final int PKCS7_CRLS
      Used as the "which" field in d2i_PKCS7_bio and PEM_read_bio_PKCS7.
      See Also:
      Constant Field Values
    • OPENSSL_TO_STANDARD_CIPHER_SUITES

      public static final Map<String,​String> OPENSSL_TO_STANDARD_CIPHER_SUITES
    • STANDARD_TO_OPENSSL_CIPHER_SUITES

      public static final Map<String,​String> STANDARD_TO_OPENSSL_CIPHER_SUITES
    • TLS_EMPTY_RENEGOTIATION_INFO_SCSV

      public static final String TLS_EMPTY_RENEGOTIATION_INFO_SCSV
      TLS_EMPTY_RENEGOTIATION_INFO_SCSV is RFC 5746's renegotiation indication signaling cipher suite value. It is not a real cipher suite. It is just an indication in the default and supported cipher suite lists indicates that the implementation supports secure renegotiation. In the RI, its presence means that the SCSV is sent in the cipher suite list to indicate secure renegotiation support and its absense means to send an empty TLS renegotiation info extension instead. However, OpenSSL doesn't provide an API to give this level of control, instead always sending the SCSV and always including the empty renegotiation info if TLS is used (as opposed to SSL). So we simply allow TLS_EMPTY_RENEGOTIATION_INFO_SCSV to be passed for compatibility as to provide the hint that we support secure renegotiation.
      See Also:
      Constant Field Values
    • EVP_PKEY_RSA

      public static final int EVP_PKEY_RSA
      See Also:
      Constant Field Values
    • EVP_PKEY_DSA

      public static final int EVP_PKEY_DSA
      See Also:
      Constant Field Values
    • EVP_PKEY_DH

      public static final int EVP_PKEY_DH
      See Also:
      Constant Field Values
    • EVP_PKEY_EC

      public static final int EVP_PKEY_EC
      See Also:
      Constant Field Values
    • EVP_PKEY_HMAC

      public static final int EVP_PKEY_HMAC
      See Also:
      Constant Field Values
    • EVP_PKEY_CMAC

      public static final int EVP_PKEY_CMAC
      See Also:
      Constant Field Values
    • RSA_PKCS1_PADDING

      public static final int RSA_PKCS1_PADDING
      See Also:
      Constant Field Values
    • RSA_NO_PADDING

      public static final int RSA_NO_PADDING
      See Also:
      Constant Field Values
    • SSL_MODE_HANDSHAKE_CUTTHROUGH

      public static final long SSL_MODE_HANDSHAKE_CUTTHROUGH
      See Also:
      Constant Field Values
    • SSL_OP_NO_TICKET

      public static final long SSL_OP_NO_TICKET
      See Also:
      Constant Field Values
    • SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION

      public static final long SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION
      See Also:
      Constant Field Values
    • SSL_OP_NO_SSLv3

      public static final long SSL_OP_NO_SSLv3
      See Also:
      Constant Field Values
    • SSL_OP_NO_TLSv1

      public static final long SSL_OP_NO_TLSv1
      See Also:
      Constant Field Values
    • SSL_OP_NO_TLSv1_1

      public static final long SSL_OP_NO_TLSv1_1
      See Also:
      Constant Field Values
    • SSL_OP_NO_TLSv1_2

      public static final long SSL_OP_NO_TLSv1_2
      See Also:
      Constant Field Values
    • SSL_VERIFY_NONE

      public static final int SSL_VERIFY_NONE
      See Also:
      Constant Field Values
    • SSL_VERIFY_PEER

      public static final int SSL_VERIFY_PEER
      See Also:
      Constant Field Values
    • SSL_VERIFY_FAIL_IF_NO_PEER_CERT

      public static final int SSL_VERIFY_FAIL_IF_NO_PEER_CERT
      See Also:
      Constant Field Values
  • Constructor Details

    • NativeCrypto

      public NativeCrypto()
  • Method Details

    • ENGINE_load_dynamic

      public static void ENGINE_load_dynamic()
    • ENGINE_by_id

      public static long ENGINE_by_id​(String id)
    • ENGINE_add

      public static int ENGINE_add​(long e)
    • ENGINE_init

      public static int ENGINE_init​(long e)
    • ENGINE_finish

      public static int ENGINE_finish​(long e)
    • ENGINE_free

      public static int ENGINE_free​(long e)
    • ENGINE_load_private_key

      public static long ENGINE_load_private_key​(long e, String key_id)
    • ENGINE_get_id

      public static String ENGINE_get_id​(long engineRef)
    • ENGINE_ctrl_cmd_string

      public static int ENGINE_ctrl_cmd_string​(long engineRef, String cmd, String arg, int cmd_optional)
    • EVP_PKEY_new_DSA

      public static long EVP_PKEY_new_DSA​(byte[] p, byte[] q, byte[] g, byte[] pub_key, byte[] priv_key)
    • EVP_PKEY_new_RSA

      public static long EVP_PKEY_new_RSA​(byte[] n, byte[] e, byte[] d, byte[] p, byte[] q, byte[] dmp1, byte[] dmq1, byte[] iqmp)
    • EVP_PKEY_new_mac_key

      public static long EVP_PKEY_new_mac_key​(int type, byte[] key)
    • EVP_PKEY_size

      public static int EVP_PKEY_size​(long pkey)
    • EVP_PKEY_type

      public static int EVP_PKEY_type​(long pkey)
    • EVP_PKEY_print_public

      public static String EVP_PKEY_print_public​(long pkeyRef)
    • EVP_PKEY_print_private

      public static String EVP_PKEY_print_private​(long pkeyRef)
    • EVP_PKEY_free

      public static void EVP_PKEY_free​(long pkey)
    • EVP_PKEY_cmp

      public static int EVP_PKEY_cmp​(long pkey1, long pkey2)
    • i2d_PKCS8_PRIV_KEY_INFO

      public static byte[] i2d_PKCS8_PRIV_KEY_INFO​(long pkey)
    • d2i_PKCS8_PRIV_KEY_INFO

      public static long d2i_PKCS8_PRIV_KEY_INFO​(byte[] data)
    • i2d_PUBKEY

      public static byte[] i2d_PUBKEY​(long pkey)
    • d2i_PUBKEY

      public static long d2i_PUBKEY​(byte[] data)
    • RSA_generate_key_ex

      public static long RSA_generate_key_ex​(int modulusBits, byte[] publicExponent)
    • RSA_size

      public static int RSA_size​(long pkey)
    • RSA_private_encrypt

      public static int RSA_private_encrypt​(int flen, byte[] from, byte[] to, long pkey, int padding)
    • RSA_public_decrypt

      public static int RSA_public_decrypt​(int flen, byte[] from, byte[] to, long pkey, int padding) throws BadPaddingException, SignatureException
      Throws:
      BadPaddingException
      SignatureException
    • RSA_public_encrypt

      public static int RSA_public_encrypt​(int flen, byte[] from, byte[] to, long pkey, int padding)
    • RSA_private_decrypt

      public static int RSA_private_decrypt​(int flen, byte[] from, byte[] to, long pkey, int padding) throws BadPaddingException, SignatureException
      Throws:
      BadPaddingException
      SignatureException
    • get_RSA_public_params

      public static byte[][] get_RSA_public_params​(long rsa)
      Returns:
      array of {n, e}
    • get_RSA_private_params

      public static byte[][] get_RSA_private_params​(long rsa)
      Returns:
      array of {n, e, d, p, q, dmp1, dmq1, iqmp}
    • DSA_generate_key

      public static long DSA_generate_key​(int primeBits, byte[] seed, byte[] g, byte[] p, byte[] q)
    • get_DSA_params

      public static byte[][] get_DSA_params​(long dsa)
      Returns:
      array of {g, p, q, y(pub), x(priv)}
    • i2d_RSAPublicKey

      public static byte[] i2d_RSAPublicKey​(long rsa)
    • i2d_RSAPrivateKey

      public static byte[] i2d_RSAPrivateKey​(long rsa)
    • i2d_DSAPublicKey

      public static byte[] i2d_DSAPublicKey​(long dsa)
    • i2d_DSAPrivateKey

      public static byte[] i2d_DSAPrivateKey​(long dsa)
    • EVP_PKEY_new_EC_KEY

      public static long EVP_PKEY_new_EC_KEY​(long groupRef, long pubkeyRef, byte[] privkey)
    • EC_GROUP_new_by_curve_name

      public static long EC_GROUP_new_by_curve_name​(String curveName)
    • EC_GROUP_new_curve

      public static long EC_GROUP_new_curve​(int type, byte[] p, byte[] a, byte[] b)
    • EC_GROUP_dup

      public static long EC_GROUP_dup​(long groupRef)
    • EC_GROUP_set_asn1_flag

      public static void EC_GROUP_set_asn1_flag​(long groupRef, int flag)
    • EC_GROUP_set_point_conversion_form

      public static void EC_GROUP_set_point_conversion_form​(long groupRef, int form)
    • EC_GROUP_get_curve_name

      public static String EC_GROUP_get_curve_name​(long groupRef)
    • EC_GROUP_get_curve

      public static byte[][] EC_GROUP_get_curve​(long groupRef)
    • EC_GROUP_clear_free

      public static void EC_GROUP_clear_free​(long ctx)
    • EC_GROUP_cmp

      public static boolean EC_GROUP_cmp​(long ctx1, long ctx2)
    • EC_GROUP_set_generator

      public static void EC_GROUP_set_generator​(long groupCtx, long pointCtx, byte[] n, byte[] h)
    • EC_GROUP_get_generator

      public static long EC_GROUP_get_generator​(long groupCtx)
    • get_EC_GROUP_type

      public static int get_EC_GROUP_type​(long groupCtx)
    • EC_GROUP_get_order

      public static byte[] EC_GROUP_get_order​(long groupCtx)
    • EC_GROUP_get_degree

      public static int EC_GROUP_get_degree​(long groupCtx)
    • EC_GROUP_get_cofactor

      public static byte[] EC_GROUP_get_cofactor​(long groupCtx)
    • EC_POINT_new

      public static long EC_POINT_new​(long groupRef)
    • EC_POINT_clear_free

      public static void EC_POINT_clear_free​(long pointRef)
    • EC_POINT_cmp

      public static boolean EC_POINT_cmp​(long groupRef, long pointRef1, long pointRef2)
    • EC_POINT_get_affine_coordinates

      public static byte[][] EC_POINT_get_affine_coordinates​(long groupCtx, long pointCtx)
    • EC_POINT_set_affine_coordinates

      public static void EC_POINT_set_affine_coordinates​(long groupCtx, long pointCtx, byte[] x, byte[] y)
    • EC_KEY_generate_key

      public static long EC_KEY_generate_key​(long groupRef)
    • EC_KEY_get0_group

      public static long EC_KEY_get0_group​(long pkeyRef)
    • EC_KEY_get_private_key

      public static byte[] EC_KEY_get_private_key​(long keyRef)
    • EC_KEY_get_public_key

      public static long EC_KEY_get_public_key​(long keyRef)
    • ECDH_compute_key

      public static int ECDH_compute_key​(byte[] out, int outOffset, long publicKeyRef, long privateKeyRef)
    • EVP_get_digestbyname

      public static long EVP_get_digestbyname​(String name)
    • EVP_MD_size

      public static int EVP_MD_size​(long evp_md)
    • EVP_MD_block_size

      public static int EVP_MD_block_size​(long evp_md)
    • EVP_MD_CTX_create

      public static long EVP_MD_CTX_create()
    • EVP_MD_CTX_init

      public static void EVP_MD_CTX_init​(long ctx)
    • EVP_MD_CTX_destroy

      public static void EVP_MD_CTX_destroy​(long ctx)
    • EVP_MD_CTX_copy

      public static long EVP_MD_CTX_copy​(long ctx)
    • EVP_DigestInit

      public static long EVP_DigestInit​(long evp_md)
    • EVP_DigestUpdate

      public static void EVP_DigestUpdate​(long ctx, byte[] buffer, int offset, int length)
    • EVP_DigestFinal

      public static int EVP_DigestFinal​(long ctx, byte[] hash, int offset)
    • EVP_DigestSignInit

      public static void EVP_DigestSignInit​(long evp_md_ctx, long evp_md, long evp_pkey)
    • EVP_DigestSignUpdate

      public static void EVP_DigestSignUpdate​(long evp_md_ctx, byte[] in, int offset, int length)
    • EVP_DigestSignFinal

      public static byte[] EVP_DigestSignFinal​(long evp_md_ctx)
    • EVP_SignInit

      public static long EVP_SignInit​(String algorithm)
    • EVP_SignUpdate

      public static void EVP_SignUpdate​(long ctx, byte[] buffer, int offset, int length)
    • EVP_SignFinal

      public static int EVP_SignFinal​(long ctx, byte[] signature, int offset, long key)
    • EVP_VerifyInit

      public static long EVP_VerifyInit​(String algorithm)
    • EVP_VerifyUpdate

      public static void EVP_VerifyUpdate​(long ctx, byte[] buffer, int offset, int length)
    • EVP_VerifyFinal

      public static int EVP_VerifyFinal​(long ctx, byte[] signature, int offset, int length, long key)
    • EVP_get_cipherbyname

      public static long EVP_get_cipherbyname​(String string)
    • EVP_CipherInit_ex

      public static void EVP_CipherInit_ex​(long ctx, long evpCipher, byte[] key, byte[] iv, boolean encrypting)
    • EVP_CipherUpdate

      public static int EVP_CipherUpdate​(long ctx, byte[] out, int outOffset, byte[] in, int inOffset, int inLength)
    • EVP_CipherFinal_ex

      public static int EVP_CipherFinal_ex​(long ctx, byte[] out, int outOffset) throws BadPaddingException, IllegalBlockSizeException
      Throws:
      BadPaddingException
      IllegalBlockSizeException
    • EVP_CIPHER_iv_length

      public static int EVP_CIPHER_iv_length​(long evpCipher)
    • EVP_CIPHER_CTX_new

      public static long EVP_CIPHER_CTX_new()
    • EVP_CIPHER_CTX_block_size

      public static int EVP_CIPHER_CTX_block_size​(long ctx)
    • get_EVP_CIPHER_CTX_buf_len

      public static int get_EVP_CIPHER_CTX_buf_len​(long ctx)
    • EVP_CIPHER_CTX_set_padding

      public static void EVP_CIPHER_CTX_set_padding​(long ctx, boolean enablePadding)
    • EVP_CIPHER_CTX_set_key_length

      public static void EVP_CIPHER_CTX_set_key_length​(long ctx, int keyBitSize)
    • EVP_CIPHER_CTX_cleanup

      public static void EVP_CIPHER_CTX_cleanup​(long ctx)
    • RAND_seed

      public static void RAND_seed​(byte[] seed)
    • RAND_load_file

      public static int RAND_load_file​(String filename, long max_bytes)
    • RAND_bytes

      public static void RAND_bytes​(byte[] output)
    • OBJ_txt2nid

      public static int OBJ_txt2nid​(String oid)
    • OBJ_txt2nid_longName

      public static String OBJ_txt2nid_longName​(String oid)
    • OBJ_txt2nid_oid

      public static String OBJ_txt2nid_oid​(String oid)
    • X509_NAME_hash

      public static int X509_NAME_hash​(X500Principal principal)
    • X509_NAME_hash_old

      public static int X509_NAME_hash_old​(X500Principal principal)
    • X509_NAME_print_ex

      public static String X509_NAME_print_ex​(long x509nameCtx, long flags)
    • d2i_X509_bio

      public static long d2i_X509_bio​(long bioCtx)
    • d2i_X509

      public static long d2i_X509​(byte[] encoded)
    • PEM_read_bio_X509

      public static long PEM_read_bio_X509​(long bioCtx)
    • i2d_X509

      public static byte[] i2d_X509​(long x509ctx)
    • i2d_X509_PUBKEY

      public static byte[] i2d_X509_PUBKEY​(long x509ctx)
      Takes an X509 context not an X509_PUBKEY context.
    • ASN1_seq_pack_X509

      public static byte[] ASN1_seq_pack_X509​(long[] x509CertRefs)
    • ASN1_seq_unpack_X509_bio

      public static long[] ASN1_seq_unpack_X509_bio​(long bioRef)
    • X509_free

      public static void X509_free​(long x509ctx)
    • X509_cmp

      public static int X509_cmp​(long x509ctx1, long x509ctx2)
    • get_X509_hashCode

      public static int get_X509_hashCode​(long x509ctx)
    • X509_print_ex

      public static void X509_print_ex​(long bioCtx, long x509ctx, long nmflag, long certflag)
    • X509_get_issuer_name

      public static byte[] X509_get_issuer_name​(long x509ctx)
    • X509_get_subject_name

      public static byte[] X509_get_subject_name​(long x509ctx)
    • get_X509_sig_alg_oid

      public static String get_X509_sig_alg_oid​(long x509ctx)
    • get_X509_sig_alg_parameter

      public static byte[] get_X509_sig_alg_parameter​(long x509ctx)
    • get_X509_issuerUID

      public static boolean[] get_X509_issuerUID​(long x509ctx)
    • get_X509_subjectUID

      public static boolean[] get_X509_subjectUID​(long x509ctx)
    • X509_get_pubkey

      public static long X509_get_pubkey​(long x509ctx) throws NoSuchAlgorithmException
      Throws:
      NoSuchAlgorithmException
    • get_X509_pubkey_oid

      public static String get_X509_pubkey_oid​(long x509ctx)
    • X509_get_ext_oid

      public static byte[] X509_get_ext_oid​(long x509ctx, String oid)
    • get_X509_ext_oids

      public static String[] get_X509_ext_oids​(long x509ctx, int critical)
    • get_X509_GENERAL_NAME_stack

      public static Object[][] get_X509_GENERAL_NAME_stack​(long x509ctx, int type) throws CertificateParsingException
      Throws:
      CertificateParsingException
    • get_X509_ex_kusage

      public static boolean[] get_X509_ex_kusage​(long x509ctx)
    • get_X509_ex_xkusage

      public static String[] get_X509_ex_xkusage​(long x509ctx)
    • get_X509_ex_pathlen

      public static int get_X509_ex_pathlen​(long x509ctx)
    • X509_get_notBefore

      public static long X509_get_notBefore​(long x509ctx)
    • X509_get_notAfter

      public static long X509_get_notAfter​(long x509ctx)
    • X509_get_version

      public static long X509_get_version​(long x509ctx)
    • X509_get_serialNumber

      public static byte[] X509_get_serialNumber​(long x509ctx)
    • X509_verify

      public static void X509_verify​(long x509ctx, long pkeyCtx)
    • get_X509_cert_info_enc

      public static byte[] get_X509_cert_info_enc​(long x509ctx)
    • get_X509_signature

      public static byte[] get_X509_signature​(long x509ctx)
    • get_X509_ex_flags

      public static int get_X509_ex_flags​(long x509ctx)
    • X509_check_issued

      public static int X509_check_issued​(long ctx, long ctx2)
    • d2i_PKCS7_bio

      public static long[] d2i_PKCS7_bio​(long bioCtx, int which)
      Returns an array of X509 or X509_CRL pointers.
    • i2d_PKCS7

      public static byte[] i2d_PKCS7​(long[] certs)
      Returns an array of X509 or X509_CRL pointers.
    • PEM_read_bio_PKCS7

      public static long[] PEM_read_bio_PKCS7​(long bioCtx, int which)
      Returns an array of X509 or X509_CRL pointers.
    • d2i_X509_CRL_bio

      public static long d2i_X509_CRL_bio​(long bioCtx)
    • PEM_read_bio_X509_CRL

      public static long PEM_read_bio_X509_CRL​(long bioCtx)
    • i2d_X509_CRL

      public static byte[] i2d_X509_CRL​(long x509CrlCtx)
    • X509_CRL_free

      public static void X509_CRL_free​(long x509CrlCtx)
    • X509_CRL_print

      public static void X509_CRL_print​(long bioCtx, long x509CrlCtx)
    • get_X509_CRL_sig_alg_oid

      public static String get_X509_CRL_sig_alg_oid​(long x509CrlCtx)
    • get_X509_CRL_sig_alg_parameter

      public static byte[] get_X509_CRL_sig_alg_parameter​(long x509CrlCtx)
    • X509_CRL_get_issuer_name

      public static byte[] X509_CRL_get_issuer_name​(long x509CrlCtx)
    • X509_CRL_get0_by_cert

      public static long X509_CRL_get0_by_cert​(long x509CrlCtx, long x509Ctx)
      Returns X509_REVOKED reference that is not duplicated!
    • X509_CRL_get0_by_serial

      public static long X509_CRL_get0_by_serial​(long x509CrlCtx, byte[] serial)
      Returns X509_REVOKED reference that is not duplicated!
    • X509_CRL_get_REVOKED

      public static long[] X509_CRL_get_REVOKED​(long x509CrlCtx)
      Returns an array of X509_REVOKED that are owned by the caller.
    • get_X509_CRL_ext_oids

      public static String[] get_X509_CRL_ext_oids​(long x509ctx, int critical)
    • X509_CRL_get_ext_oid

      public static byte[] X509_CRL_get_ext_oid​(long x509CrlCtx, String oid)
    • X509_CRL_get_version

      public static long X509_CRL_get_version​(long x509CrlCtx)
    • X509_CRL_get_ext

      public static long X509_CRL_get_ext​(long x509CrlCtx, String oid)
    • get_X509_CRL_signature

      public static byte[] get_X509_CRL_signature​(long x509ctx)
    • X509_CRL_verify

      public static void X509_CRL_verify​(long x509CrlCtx, long pkeyCtx)
    • get_X509_CRL_crl_enc

      public static byte[] get_X509_CRL_crl_enc​(long x509CrlCtx)
    • X509_CRL_get_lastUpdate

      public static long X509_CRL_get_lastUpdate​(long x509CrlCtx)
    • X509_CRL_get_nextUpdate

      public static long X509_CRL_get_nextUpdate​(long x509CrlCtx)
    • X509_REVOKED_dup

      public static long X509_REVOKED_dup​(long x509RevokedCtx)
    • i2d_X509_REVOKED

      public static byte[] i2d_X509_REVOKED​(long x509RevokedCtx)
    • get_X509_REVOKED_ext_oids

      public static String[] get_X509_REVOKED_ext_oids​(long x509ctx, int critical)
    • X509_REVOKED_get_ext_oid

      public static byte[] X509_REVOKED_get_ext_oid​(long x509RevokedCtx, String oid)
    • X509_REVOKED_get_serialNumber

      public static byte[] X509_REVOKED_get_serialNumber​(long x509RevokedCtx)
    • X509_REVOKED_get_ext

      public static long X509_REVOKED_get_ext​(long x509RevokedCtx, String oid)
    • get_X509_REVOKED_revocationDate

      public static long get_X509_REVOKED_revocationDate​(long x509RevokedCtx)
      Returns ASN1_TIME reference.
    • X509_REVOKED_print

      public static void X509_REVOKED_print​(long bioRef, long x509RevokedCtx)
    • X509_supported_extension

      public static int X509_supported_extension​(long x509ExtensionRef)
    • ASN1_TIME_to_Calendar

      public static void ASN1_TIME_to_Calendar​(long asn1TimeCtx, Calendar cal)
    • create_BIO_InputStream

      public static long create_BIO_InputStream​(OpenSSLBIOInputStream is)
    • create_BIO_OutputStream

      public static long create_BIO_OutputStream​(OutputStream os)
    • BIO_read

      public static int BIO_read​(long bioRef, byte[] buffer)
    • BIO_write

      public static void BIO_write​(long bioRef, byte[] buffer, int offset, int length) throws IOException
      Throws:
      IOException
    • BIO_free

      public static void BIO_free​(long bioRef)
    • SSL_CTX_new

      public static long SSL_CTX_new()
    • getDefaultCipherSuites

      public static String[] getDefaultCipherSuites()
    • getSupportedCipherSuites

      public static String[] getSupportedCipherSuites()
    • SSL_CTX_free

      public static void SSL_CTX_free​(long ssl_ctx)
    • SSL_CTX_set_session_id_context

      public static void SSL_CTX_set_session_id_context​(long ssl_ctx, byte[] sid_ctx)
    • SSL_new

      public static long SSL_new​(long ssl_ctx) throws SSLException
      Throws:
      SSLException
    • SSL_enable_tls_channel_id

      public static void SSL_enable_tls_channel_id​(long ssl) throws SSLException
      Throws:
      SSLException
    • SSL_get_tls_channel_id

      public static byte[] SSL_get_tls_channel_id​(long ssl) throws SSLException
      Throws:
      SSLException
    • SSL_set1_tls_channel_id

      public static void SSL_set1_tls_channel_id​(long ssl, long pkey)
    • encodeCertificates

      public static byte[][] encodeCertificates​(Certificate[] certificates) throws CertificateEncodingException
      Throws:
      CertificateEncodingException
    • SSL_use_certificate

      public static void SSL_use_certificate​(long ssl, byte[][] asn1DerEncodedCertificateChain)
    • SSL_use_PrivateKey

      public static void SSL_use_PrivateKey​(long ssl, long pkey)
    • SSL_check_private_key

      public static void SSL_check_private_key​(long ssl) throws SSLException
      Throws:
      SSLException
    • SSL_set_client_CA_list

      public static void SSL_set_client_CA_list​(long ssl, byte[][] asn1DerEncodedX500Principals)
    • SSL_get_mode

      public static long SSL_get_mode​(long ssl)
    • SSL_set_mode

      public static long SSL_set_mode​(long ssl, long mode)
    • SSL_clear_mode

      public static long SSL_clear_mode​(long ssl, long mode)
    • SSL_get_options

      public static long SSL_get_options​(long ssl)
    • SSL_set_options

      public static long SSL_set_options​(long ssl, long options)
    • SSL_clear_options

      public static long SSL_clear_options​(long ssl, long options)
    • getDefaultProtocols

      public static String[] getDefaultProtocols()
    • getSupportedProtocols

      public static String[] getSupportedProtocols()
    • setEnabledProtocols

      public static void setEnabledProtocols​(long ssl, String[] protocols)
    • checkEnabledProtocols

      public static String[] checkEnabledProtocols​(String[] protocols)
    • SSL_set_cipher_lists

      public static void SSL_set_cipher_lists​(long ssl, String[] ciphers)
    • setEnabledCipherSuites

      public static void setEnabledCipherSuites​(long ssl, String[] cipherSuites)
    • checkEnabledCipherSuites

      public static String[] checkEnabledCipherSuites​(String[] cipherSuites)
    • SSL_set_verify

      public static void SSL_set_verify​(long sslNativePointer, int mode)
    • SSL_set_session

      public static void SSL_set_session​(long sslNativePointer, long sslSessionNativePointer) throws SSLException
      Throws:
      SSLException
    • SSL_set_session_creation_enabled

      public static void SSL_set_session_creation_enabled​(long sslNativePointer, boolean creationEnabled) throws SSLException
      Throws:
      SSLException
    • SSL_set_tlsext_host_name

      public static void SSL_set_tlsext_host_name​(long sslNativePointer, String hostname) throws SSLException
      Throws:
      SSLException
    • SSL_get_servername

      public static String SSL_get_servername​(long sslNativePointer)
    • SSL_CTX_enable_npn

      public static void SSL_CTX_enable_npn​(long sslCtxNativePointer)
      Enables NPN for all SSL connections in the context.

      For clients this causes the NPN extension to be included in the ClientHello message.

      For servers this causes the NPN extension to be included in the ServerHello message. The NPN extension will not be included in the ServerHello response if the client didn't include it in the ClientHello request.

      In either case the caller should pass a non-null byte array of NPN protocols to SSL_do_handshake(long, java.io.FileDescriptor, org.conscrypt.NativeCrypto.SSLHandshakeCallbacks, int, boolean, byte[], byte[]).

    • SSL_CTX_disable_npn

      public static void SSL_CTX_disable_npn​(long sslCtxNativePointer)
      Disables NPN for all SSL connections in the context.
    • SSL_set_alpn_protos

      public static int SSL_set_alpn_protos​(long sslPointer, byte[] protos)
      For clients, sets the list of supported ALPN protocols in wire-format (length-prefixed 8-bit strings).
    • SSL_get0_alpn_selected

      public static byte[] SSL_get0_alpn_selected​(long sslPointer)
      Returns the selected ALPN protocol. If the server did not select a protocol, null will be returned.
    • SSL_do_handshake

      public static long SSL_do_handshake​(long sslNativePointer, FileDescriptor fd, NativeCrypto.SSLHandshakeCallbacks shc, int timeoutMillis, boolean client_mode, byte[] npnProtocols, byte[] alpnProtocols) throws SSLException, SocketTimeoutException, CertificateException
      Returns the sslSessionNativePointer of the negotiated session. If this is a server negotiation, supplying the alpnProtocols will enable ALPN negotiation.
      Throws:
      SSLException
      SocketTimeoutException
      CertificateException
    • SSL_get_npn_negotiated_protocol

      public static byte[] SSL_get_npn_negotiated_protocol​(long sslNativePointer)
    • SSL_renegotiate

      public static void SSL_renegotiate​(long sslNativePointer) throws SSLException
      Currently only intended for forcing renegotiation for testing. Not used within OpenSSLSocketImpl.
      Throws:
      SSLException
    • SSL_get_certificate

      public static byte[][] SSL_get_certificate​(long sslNativePointer)
      Returns the local ASN.1 DER encoded X509 certificates.
    • SSL_get_peer_cert_chain

      public static byte[][] SSL_get_peer_cert_chain​(long sslNativePointer)
      Returns the peer ASN.1 DER encoded X509 certificates.
    • SSL_read

      public static int SSL_read​(long sslNativePointer, FileDescriptor fd, NativeCrypto.SSLHandshakeCallbacks shc, byte[] b, int off, int len, int readTimeoutMillis) throws IOException
      Reads with the native SSL_read function from the encrypted data stream
      Returns:
      -1 if error or the end of the stream is reached.
      Throws:
      IOException
    • SSL_write

      public static void SSL_write​(long sslNativePointer, FileDescriptor fd, NativeCrypto.SSLHandshakeCallbacks shc, byte[] b, int off, int len, int writeTimeoutMillis) throws IOException
      Writes with the native SSL_write function to the encrypted data stream.
      Throws:
      IOException
    • SSL_interrupt

      public static void SSL_interrupt​(long sslNativePointer)
    • SSL_shutdown

      public static void SSL_shutdown​(long sslNativePointer, FileDescriptor fd, NativeCrypto.SSLHandshakeCallbacks shc) throws IOException
      Throws:
      IOException
    • SSL_free

      public static void SSL_free​(long sslNativePointer)
    • SSL_SESSION_session_id

      public static byte[] SSL_SESSION_session_id​(long sslSessionNativePointer)
    • SSL_SESSION_get_time

      public static long SSL_SESSION_get_time​(long sslSessionNativePointer)
    • SSL_SESSION_get_version

      public static String SSL_SESSION_get_version​(long sslSessionNativePointer)
    • SSL_SESSION_cipher

      public static String SSL_SESSION_cipher​(long sslSessionNativePointer)
    • SSL_SESSION_free

      public static void SSL_SESSION_free​(long sslSessionNativePointer)
    • i2d_SSL_SESSION

      public static byte[] i2d_SSL_SESSION​(long sslSessionNativePointer)
    • d2i_SSL_SESSION

      public static long d2i_SSL_SESSION​(byte[] data)
    • ERR_peek_last_error

      public static long ERR_peek_last_error()