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.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceNativeCrypto.SSLHandshakeCallbacksA collection of callbacks from the native OpenSSL code that are related to the SSL handshake initiated by SSL_do_handshake. -
Field Summary
Fields Modifier and Type Field Description static intEC_CURVE_GF2MUsed to request EC_GROUP_new_curve_GF2m to EC_GROUP_new_curvestatic intEC_CURVE_GFPUsed to request EC_GROUP_new_curve_GFp to EC_GROUP_new_curvestatic intEVP_PKEY_CMACstatic intEVP_PKEY_DHstatic intEVP_PKEY_DSAstatic intEVP_PKEY_ECstatic intEVP_PKEY_HMACstatic intEVP_PKEY_RSAstatic intEXFLAG_CAstatic intEXFLAG_CRITICALstatic intEXTENSION_TYPE_CRITICALUsed to request only critical types in get_X509*_ext_oids.static intEXTENSION_TYPE_NON_CRITICALUsed to request only non-critical types in get_X509*_ext_oids.static intGN_STACK_ISSUER_ALT_NAMEUsed to request get_X509_GENERAL_NAME_stack get the issuerAlternativeName extension.static intGN_STACK_SUBJECT_ALT_NAMEUsed to request get_X509_GENERAL_NAME_stack get the "altname" field.static intOPENSSL_EC_NAMED_CURVEEC_GROUP_set_asn1_flag: indicates an EC_GROUP is a NamedCurve.static Map<String,String>OPENSSL_TO_STANDARD_CIPHER_SUITESstatic intPKCS7_CERTSUsed as the "which" field in d2i_PKCS7_bio and PEM_read_bio_PKCS7.static intPKCS7_CRLSUsed as the "which" field in d2i_PKCS7_bio and PEM_read_bio_PKCS7.static intPOINT_CONVERSION_COMPRESSEDEC_GROUP_set_point_conversion_form: indicates compressed ASN.1 formatstatic intPOINT_CONVERSION_HYBRIDEC_GROUP_set_point_conversion_form: indicates hybrid ASN.1 formatstatic intPOINT_CONVERSION_UNCOMPRESSEDEC_GROUP_set_point_conversion_form: indicates uncompressed ASN.1 formatstatic intRAND_SEED_LENGTH_IN_BYTESstatic intRSA_NO_PADDINGstatic intRSA_PKCS1_PADDINGstatic longSSL_MODE_HANDSHAKE_CUTTHROUGHstatic longSSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATIONstatic longSSL_OP_NO_SSLv3static longSSL_OP_NO_TICKETstatic longSSL_OP_NO_TLSv1static longSSL_OP_NO_TLSv1_1static longSSL_OP_NO_TLSv1_2static intSSL_VERIFY_FAIL_IF_NO_PEER_CERTstatic intSSL_VERIFY_NONEstatic intSSL_VERIFY_PEERstatic Map<String,String>STANDARD_TO_OPENSSL_CIPHER_SUITESstatic StringTLS_EMPTY_RENEGOTIATION_INFO_SCSVTLS_EMPTY_RENEGOTIATION_INFO_SCSV is RFC 5746's renegotiation indication signaling cipher suite value. -
Constructor Summary
Constructors Constructor Description NativeCrypto() -
Method Summary
Modifier and Type Method Description static byte[]ASN1_seq_pack_X509(long[] x509CertRefs)static long[]ASN1_seq_unpack_X509_bio(long bioRef)static voidASN1_TIME_to_Calendar(long asn1TimeCtx, Calendar cal)static voidBIO_free(long bioRef)static intBIO_read(long bioRef, byte[] buffer)static voidBIO_write(long bioRef, byte[] buffer, int offset, int length)static String[]checkEnabledCipherSuites(String[] cipherSuites)static String[]checkEnabledProtocols(String[] protocols)static longcreate_BIO_InputStream(OpenSSLBIOInputStream is)static longcreate_BIO_OutputStream(OutputStream os)static long[]d2i_PKCS7_bio(long bioCtx, int which)Returns an array of X509 or X509_CRL pointers.static longd2i_PKCS8_PRIV_KEY_INFO(byte[] data)static longd2i_PUBKEY(byte[] data)static longd2i_SSL_SESSION(byte[] data)static longd2i_X509(byte[] encoded)static longd2i_X509_bio(long bioCtx)static longd2i_X509_CRL_bio(long bioCtx)static longDSA_generate_key(int primeBits, byte[] seed, byte[] g, byte[] p, byte[] q)static voidEC_GROUP_clear_free(long ctx)static booleanEC_GROUP_cmp(long ctx1, long ctx2)static longEC_GROUP_dup(long groupRef)static byte[]EC_GROUP_get_cofactor(long groupCtx)static byte[][]EC_GROUP_get_curve(long groupRef)static StringEC_GROUP_get_curve_name(long groupRef)static intEC_GROUP_get_degree(long groupCtx)static longEC_GROUP_get_generator(long groupCtx)static byte[]EC_GROUP_get_order(long groupCtx)static longEC_GROUP_new_by_curve_name(String curveName)static longEC_GROUP_new_curve(int type, byte[] p, byte[] a, byte[] b)static voidEC_GROUP_set_asn1_flag(long groupRef, int flag)static voidEC_GROUP_set_generator(long groupCtx, long pointCtx, byte[] n, byte[] h)static voidEC_GROUP_set_point_conversion_form(long groupRef, int form)static longEC_KEY_generate_key(long groupRef)static byte[]EC_KEY_get_private_key(long keyRef)static longEC_KEY_get_public_key(long keyRef)static longEC_KEY_get0_group(long pkeyRef)static voidEC_POINT_clear_free(long pointRef)static booleanEC_POINT_cmp(long groupRef, long pointRef1, long pointRef2)static byte[][]EC_POINT_get_affine_coordinates(long groupCtx, long pointCtx)static longEC_POINT_new(long groupRef)static voidEC_POINT_set_affine_coordinates(long groupCtx, long pointCtx, byte[] x, byte[] y)static intECDH_compute_key(byte[] out, int outOffset, long publicKeyRef, long privateKeyRef)static byte[][]encodeCertificates(Certificate[] certificates)static intENGINE_add(long e)static longENGINE_by_id(String id)static intENGINE_ctrl_cmd_string(long engineRef, String cmd, String arg, int cmd_optional)static intENGINE_finish(long e)static intENGINE_free(long e)static StringENGINE_get_id(long engineRef)static intENGINE_init(long e)static voidENGINE_load_dynamic()static longENGINE_load_private_key(long e, String key_id)static longERR_peek_last_error()static intEVP_CIPHER_CTX_block_size(long ctx)static voidEVP_CIPHER_CTX_cleanup(long ctx)static longEVP_CIPHER_CTX_new()static voidEVP_CIPHER_CTX_set_key_length(long ctx, int keyBitSize)static voidEVP_CIPHER_CTX_set_padding(long ctx, boolean enablePadding)static intEVP_CIPHER_iv_length(long evpCipher)static intEVP_CipherFinal_ex(long ctx, byte[] out, int outOffset)static voidEVP_CipherInit_ex(long ctx, long evpCipher, byte[] key, byte[] iv, boolean encrypting)static intEVP_CipherUpdate(long ctx, byte[] out, int outOffset, byte[] in, int inOffset, int inLength)static intEVP_DigestFinal(long ctx, byte[] hash, int offset)static longEVP_DigestInit(long evp_md)static byte[]EVP_DigestSignFinal(long evp_md_ctx)static voidEVP_DigestSignInit(long evp_md_ctx, long evp_md, long evp_pkey)static voidEVP_DigestSignUpdate(long evp_md_ctx, byte[] in, int offset, int length)static voidEVP_DigestUpdate(long ctx, byte[] buffer, int offset, int length)static longEVP_get_cipherbyname(String string)static longEVP_get_digestbyname(String name)static intEVP_MD_block_size(long evp_md)static longEVP_MD_CTX_copy(long ctx)static longEVP_MD_CTX_create()static voidEVP_MD_CTX_destroy(long ctx)static voidEVP_MD_CTX_init(long ctx)static intEVP_MD_size(long evp_md)static intEVP_PKEY_cmp(long pkey1, long pkey2)static voidEVP_PKEY_free(long pkey)static longEVP_PKEY_new_DSA(byte[] p, byte[] q, byte[] g, byte[] pub_key, byte[] priv_key)static longEVP_PKEY_new_EC_KEY(long groupRef, long pubkeyRef, byte[] privkey)static longEVP_PKEY_new_mac_key(int type, byte[] key)static longEVP_PKEY_new_RSA(byte[] n, byte[] e, byte[] d, byte[] p, byte[] q, byte[] dmp1, byte[] dmq1, byte[] iqmp)static StringEVP_PKEY_print_private(long pkeyRef)static StringEVP_PKEY_print_public(long pkeyRef)static intEVP_PKEY_size(long pkey)static intEVP_PKEY_type(long pkey)static intEVP_SignFinal(long ctx, byte[] signature, int offset, long key)static longEVP_SignInit(String algorithm)static voidEVP_SignUpdate(long ctx, byte[] buffer, int offset, int length)static intEVP_VerifyFinal(long ctx, byte[] signature, int offset, int length, long key)static longEVP_VerifyInit(String algorithm)static voidEVP_VerifyUpdate(long ctx, byte[] buffer, int offset, int length)static byte[][]get_DSA_params(long dsa)static intget_EC_GROUP_type(long groupCtx)static intget_EVP_CIPHER_CTX_buf_len(long ctx)static byte[][]get_RSA_private_params(long rsa)static byte[][]get_RSA_public_params(long rsa)static byte[]get_X509_cert_info_enc(long x509ctx)static byte[]get_X509_CRL_crl_enc(long x509CrlCtx)static String[]get_X509_CRL_ext_oids(long x509ctx, int critical)static Stringget_X509_CRL_sig_alg_oid(long x509CrlCtx)static byte[]get_X509_CRL_sig_alg_parameter(long x509CrlCtx)static byte[]get_X509_CRL_signature(long x509ctx)static intget_X509_ex_flags(long x509ctx)static boolean[]get_X509_ex_kusage(long x509ctx)static intget_X509_ex_pathlen(long x509ctx)static String[]get_X509_ex_xkusage(long x509ctx)static String[]get_X509_ext_oids(long x509ctx, int critical)static Object[][]get_X509_GENERAL_NAME_stack(long x509ctx, int type)static intget_X509_hashCode(long x509ctx)static boolean[]get_X509_issuerUID(long x509ctx)static Stringget_X509_pubkey_oid(long x509ctx)static String[]get_X509_REVOKED_ext_oids(long x509ctx, int critical)static longget_X509_REVOKED_revocationDate(long x509RevokedCtx)Returns ASN1_TIME reference.static Stringget_X509_sig_alg_oid(long x509ctx)static byte[]get_X509_sig_alg_parameter(long x509ctx)static byte[]get_X509_signature(long x509ctx)static boolean[]get_X509_subjectUID(long x509ctx)static String[]getDefaultCipherSuites()static String[]getDefaultProtocols()static String[]getSupportedCipherSuites()static String[]getSupportedProtocols()static byte[]i2d_DSAPrivateKey(long dsa)static byte[]i2d_DSAPublicKey(long dsa)static byte[]i2d_PKCS7(long[] certs)Returns an array of X509 or X509_CRL pointers.static byte[]i2d_PKCS8_PRIV_KEY_INFO(long pkey)static byte[]i2d_PUBKEY(long pkey)static byte[]i2d_RSAPrivateKey(long rsa)static byte[]i2d_RSAPublicKey(long rsa)static byte[]i2d_SSL_SESSION(long sslSessionNativePointer)static byte[]i2d_X509(long x509ctx)static byte[]i2d_X509_CRL(long x509CrlCtx)static byte[]i2d_X509_PUBKEY(long x509ctx)Takes an X509 context not an X509_PUBKEY context.static byte[]i2d_X509_REVOKED(long x509RevokedCtx)static intOBJ_txt2nid(String oid)static StringOBJ_txt2nid_longName(String oid)static StringOBJ_txt2nid_oid(String oid)static long[]PEM_read_bio_PKCS7(long bioCtx, int which)Returns an array of X509 or X509_CRL pointers.static longPEM_read_bio_X509(long bioCtx)static longPEM_read_bio_X509_CRL(long bioCtx)static voidRAND_bytes(byte[] output)static intRAND_load_file(String filename, long max_bytes)static voidRAND_seed(byte[] seed)static longRSA_generate_key_ex(int modulusBits, byte[] publicExponent)static intRSA_private_decrypt(int flen, byte[] from, byte[] to, long pkey, int padding)static intRSA_private_encrypt(int flen, byte[] from, byte[] to, long pkey, int padding)static intRSA_public_decrypt(int flen, byte[] from, byte[] to, long pkey, int padding)static intRSA_public_encrypt(int flen, byte[] from, byte[] to, long pkey, int padding)static intRSA_size(long pkey)static voidsetEnabledCipherSuites(long ssl, String[] cipherSuites)static voidsetEnabledProtocols(long ssl, String[] protocols)static voidSSL_check_private_key(long ssl)static longSSL_clear_mode(long ssl, long mode)static longSSL_clear_options(long ssl, long options)static voidSSL_CTX_disable_npn(long sslCtxNativePointer)Disables NPN for all SSL connections in the context.static voidSSL_CTX_enable_npn(long sslCtxNativePointer)Enables NPN for all SSL connections in the context.static voidSSL_CTX_free(long ssl_ctx)static longSSL_CTX_new()static voidSSL_CTX_set_session_id_context(long ssl_ctx, byte[] sid_ctx)static longSSL_do_handshake(long sslNativePointer, FileDescriptor fd, NativeCrypto.SSLHandshakeCallbacks shc, int timeoutMillis, boolean client_mode, byte[] npnProtocols, byte[] alpnProtocols)Returns the sslSessionNativePointer of the negotiated session.static voidSSL_enable_tls_channel_id(long ssl)static voidSSL_free(long sslNativePointer)static byte[][]SSL_get_certificate(long sslNativePointer)Returns the local ASN.1 DER encoded X509 certificates.static longSSL_get_mode(long ssl)static byte[]SSL_get_npn_negotiated_protocol(long sslNativePointer)static longSSL_get_options(long ssl)static byte[][]SSL_get_peer_cert_chain(long sslNativePointer)Returns the peer ASN.1 DER encoded X509 certificates.static StringSSL_get_servername(long sslNativePointer)static byte[]SSL_get_tls_channel_id(long ssl)static byte[]SSL_get0_alpn_selected(long sslPointer)Returns the selected ALPN protocol.static voidSSL_interrupt(long sslNativePointer)static longSSL_new(long ssl_ctx)static intSSL_read(long sslNativePointer, FileDescriptor fd, NativeCrypto.SSLHandshakeCallbacks shc, byte[] b, int off, int len, int readTimeoutMillis)Reads with the native SSL_read function from the encrypted data streamstatic voidSSL_renegotiate(long sslNativePointer)Currently only intended for forcing renegotiation for testing.static StringSSL_SESSION_cipher(long sslSessionNativePointer)static voidSSL_SESSION_free(long sslSessionNativePointer)static longSSL_SESSION_get_time(long sslSessionNativePointer)static StringSSL_SESSION_get_version(long sslSessionNativePointer)static byte[]SSL_SESSION_session_id(long sslSessionNativePointer)static intSSL_set_alpn_protos(long sslPointer, byte[] protos)For clients, sets the list of supported ALPN protocols in wire-format (length-prefixed 8-bit strings).static voidSSL_set_cipher_lists(long ssl, String[] ciphers)static voidSSL_set_client_CA_list(long ssl, byte[][] asn1DerEncodedX500Principals)static longSSL_set_mode(long ssl, long mode)static longSSL_set_options(long ssl, long options)static voidSSL_set_session(long sslNativePointer, long sslSessionNativePointer)static voidSSL_set_session_creation_enabled(long sslNativePointer, boolean creationEnabled)static voidSSL_set_tlsext_host_name(long sslNativePointer, String hostname)static voidSSL_set_verify(long sslNativePointer, int mode)static voidSSL_set1_tls_channel_id(long ssl, long pkey)static voidSSL_shutdown(long sslNativePointer, FileDescriptor fd, NativeCrypto.SSLHandshakeCallbacks shc)static voidSSL_use_certificate(long ssl, byte[][] asn1DerEncodedCertificateChain)static voidSSL_use_PrivateKey(long ssl, long pkey)static voidSSL_write(long sslNativePointer, FileDescriptor fd, NativeCrypto.SSLHandshakeCallbacks shc, byte[] b, int off, int len, int writeTimeoutMillis)Writes with the native SSL_write function to the encrypted data stream.static intX509_check_issued(long ctx, long ctx2)static intX509_cmp(long x509ctx1, long x509ctx2)static voidX509_CRL_free(long x509CrlCtx)static longX509_CRL_get_ext(long x509CrlCtx, String oid)static byte[]X509_CRL_get_ext_oid(long x509CrlCtx, String oid)static byte[]X509_CRL_get_issuer_name(long x509CrlCtx)static longX509_CRL_get_lastUpdate(long x509CrlCtx)static longX509_CRL_get_nextUpdate(long x509CrlCtx)static long[]X509_CRL_get_REVOKED(long x509CrlCtx)Returns an array of X509_REVOKED that are owned by the caller.static longX509_CRL_get_version(long x509CrlCtx)static longX509_CRL_get0_by_cert(long x509CrlCtx, long x509Ctx)Returns X509_REVOKED reference that is not duplicated!static longX509_CRL_get0_by_serial(long x509CrlCtx, byte[] serial)Returns X509_REVOKED reference that is not duplicated!static voidX509_CRL_print(long bioCtx, long x509CrlCtx)static voidX509_CRL_verify(long x509CrlCtx, long pkeyCtx)static voidX509_free(long x509ctx)static byte[]X509_get_ext_oid(long x509ctx, String oid)static byte[]X509_get_issuer_name(long x509ctx)static longX509_get_notAfter(long x509ctx)static longX509_get_notBefore(long x509ctx)static longX509_get_pubkey(long x509ctx)static byte[]X509_get_serialNumber(long x509ctx)static byte[]X509_get_subject_name(long x509ctx)static longX509_get_version(long x509ctx)static intX509_NAME_hash(X500Principal principal)static intX509_NAME_hash_old(X500Principal principal)static StringX509_NAME_print_ex(long x509nameCtx, long flags)static voidX509_print_ex(long bioCtx, long x509ctx, long nmflag, long certflag)static longX509_REVOKED_dup(long x509RevokedCtx)static longX509_REVOKED_get_ext(long x509RevokedCtx, String oid)static byte[]X509_REVOKED_get_ext_oid(long x509RevokedCtx, String oid)static byte[]X509_REVOKED_get_serialNumber(long x509RevokedCtx)static voidX509_REVOKED_print(long bioRef, long x509RevokedCtx)static intX509_supported_extension(long x509ExtensionRef)static voidX509_verify(long x509ctx, long pkeyCtx)
-
Field Details
-
EC_CURVE_GFP
public static final int EC_CURVE_GFPUsed 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_GF2MUsed 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_CURVEEC_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_COMPRESSEDEC_GROUP_set_point_conversion_form: indicates compressed ASN.1 format- See Also:
- Constant Field Values
-
POINT_CONVERSION_UNCOMPRESSED
public static final int POINT_CONVERSION_UNCOMPRESSEDEC_GROUP_set_point_conversion_form: indicates uncompressed ASN.1 format- See Also:
- Constant Field Values
-
POINT_CONVERSION_HYBRID
public static final int POINT_CONVERSION_HYBRIDEC_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_NAMEUsed 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_NAMEUsed 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_CRITICALUsed 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_CRITICALUsed 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_CERTSUsed 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_CRLSUsed as the "which" field in d2i_PKCS7_bio and PEM_read_bio_PKCS7.- See Also:
- Constant Field Values
-
OPENSSL_TO_STANDARD_CIPHER_SUITES
-
STANDARD_TO_OPENSSL_CIPHER_SUITES
-
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
-
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
-
ENGINE_get_id
-
ENGINE_ctrl_cmd_string
-
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
-
EVP_PKEY_print_private
-
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 -
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 -
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
-
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
-
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
-
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
-
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
-
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
-
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 -
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
-
RAND_bytes
public static void RAND_bytes(byte[] output) -
OBJ_txt2nid
-
OBJ_txt2nid_longName
-
OBJ_txt2nid_oid
-
X509_NAME_hash
-
X509_NAME_hash_old
-
X509_NAME_print_ex
-
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
-
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
- Throws:
NoSuchAlgorithmException
-
get_X509_pubkey_oid
-
X509_get_ext_oid
-
get_X509_ext_oids
-
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
-
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
-
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
-
X509_CRL_get_ext_oid
-
X509_CRL_get_version
public static long X509_CRL_get_version(long x509CrlCtx) -
X509_CRL_get_ext
-
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
-
X509_REVOKED_get_ext_oid
-
X509_REVOKED_get_serialNumber
public static byte[] X509_REVOKED_get_serialNumber(long x509RevokedCtx) -
X509_REVOKED_get_ext
-
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
-
create_BIO_InputStream
-
create_BIO_OutputStream
-
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
-
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
- Throws:
SSLException
-
SSL_enable_tls_channel_id
- Throws:
SSLException
-
SSL_get_tls_channel_id
- 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
- 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
-
getSupportedProtocols
-
setEnabledProtocols
-
checkEnabledProtocols
-
SSL_set_cipher_lists
-
setEnabledCipherSuites
-
checkEnabledCipherSuites
-
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
-
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,nullwill 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, CertificateExceptionReturns the sslSessionNativePointer of the negotiated session. If this is a server negotiation, supplying thealpnProtocolswill enable ALPN negotiation. -
SSL_get_npn_negotiated_protocol
public static byte[] SSL_get_npn_negotiated_protocol(long sslNativePointer) -
SSL_renegotiate
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 IOExceptionReads 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 IOExceptionWrites 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
-
SSL_SESSION_cipher
-
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()
-