Skip to content

Commit f739457

Browse files
committed
Add cert/CRL capabilities: skid, akid, dist point, netscape
1 parent 9faf4a9 commit f739457

5 files changed

Lines changed: 494 additions & 0 deletions

File tree

native/com_wolfssl_WolfSSL.c

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,58 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSL_getNID_1dnQualifier
545545
return NID_dnQualifier;
546546
}
547547

548+
JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSL_getNID_1subject_1key_1identifier
549+
(JNIEnv* jenv, jclass jcl)
550+
{
551+
(void)jenv;
552+
(void)jcl;
553+
554+
#ifdef WOLFSSL_CERT_EXT
555+
return NID_subject_key_identifier;
556+
#else
557+
return 0;
558+
#endif
559+
}
560+
561+
JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSL_getNID_1authority_1key_1identifier
562+
(JNIEnv* jenv, jclass jcl)
563+
{
564+
(void)jenv;
565+
(void)jcl;
566+
567+
#ifdef WOLFSSL_CERT_EXT
568+
return NID_authority_key_identifier;
569+
#else
570+
return 0;
571+
#endif
572+
}
573+
574+
JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSL_getNID_1crl_1distribution_1points
575+
(JNIEnv* jenv, jclass jcl)
576+
{
577+
(void)jenv;
578+
(void)jcl;
579+
580+
#ifdef WOLFSSL_CERT_EXT
581+
return NID_crl_distribution_points;
582+
#else
583+
return 0;
584+
#endif
585+
}
586+
587+
JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSL_getNID_1netscape_1cert_1type
588+
(JNIEnv* jenv, jclass jcl)
589+
{
590+
(void)jenv;
591+
(void)jcl;
592+
593+
#ifndef IGNORE_NETSCAPE_CERT_TYPE
594+
return NID_netscape_cert_type;
595+
#else
596+
return 0;
597+
#endif
598+
}
599+
548600
/* functions to return BulkCipherAlgorithm enum values from ./wolfssl/ssl.h */
549601
JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSL_getBulkCipherAlgorithmEnumNULL
550602
(JNIEnv* jenv, jclass jcl)

native/com_wolfssl_WolfSSL.h

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

native/com_wolfssl_WolfSSLCertificate.h

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/java/com/wolfssl/WolfSSL.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,30 @@ public enum TLS_VERSION {
470470
public static int NID_ext_key_usage;
471471
/** Domain name qualifier NID */
472472
public static int NID_dnQualifier;
473+
/** Subject Key Identifier NID */
474+
public static int NID_subject_key_identifier;
475+
/** Authority Key Identifier NID */
476+
public static int NID_authority_key_identifier;
477+
/** CRL Distribution Points NID */
478+
public static int NID_crl_distribution_points;
479+
/** Netscape Certificate Type NID */
480+
public static int NID_netscape_cert_type;
481+
482+
/* Netscape Certificate Type bit flags */
483+
/** Netscape Cert Type: SSL Client */
484+
public static final int NS_CERT_TYPE_SSL_CLIENT = 0x80;
485+
/** Netscape Cert Type: SSL Server */
486+
public static final int NS_CERT_TYPE_SSL_SERVER = 0x40;
487+
/** Netscape Cert Type: S/MIME */
488+
public static final int NS_CERT_TYPE_EMAIL = 0x20;
489+
/** Netscape Cert Type: Object Signing */
490+
public static final int NS_CERT_TYPE_OBJECT_SIGNING = 0x10;
491+
/** Netscape Cert Type: SSL CA */
492+
public static final int NS_CERT_TYPE_SSL_CA = 0x04;
493+
/** Netscape Cert Type: S/MIME CA */
494+
public static final int NS_CERT_TYPE_EMAIL_CA = 0x02;
495+
/** Netscape Cert Type: Object Signing CA */
496+
public static final int NS_CERT_TYPE_OBJECT_CA = 0x01;
473497

474498
/* is this object active, or has it been cleaned up? */
475499
private boolean active = false;
@@ -605,6 +629,10 @@ public WolfSSL() throws WolfSSLException {
605629
NID_basic_constraints = getNID_basic_constraints();
606630
NID_ext_key_usage = getNID_ext_key_usage();
607631
NID_dnQualifier = getNID_dnQualifier();
632+
NID_subject_key_identifier = getNID_subject_key_identifier();
633+
NID_authority_key_identifier = getNID_authority_key_identifier();
634+
NID_crl_distribution_points = getNID_crl_distribution_points();
635+
NID_netscape_cert_type = getNID_netscape_cert_type();
608636

609637
/* initialize cipher enum values */
610638
wolfssl_aes = getBulkCipherAlgorithmEnumAES();
@@ -674,6 +702,10 @@ public WolfSSL() throws WolfSSLException {
674702
static native int getNID_basic_constraints();
675703
static native int getNID_ext_key_usage();
676704
static native int getNID_dnQualifier();
705+
static native int getNID_subject_key_identifier();
706+
static native int getNID_authority_key_identifier();
707+
static native int getNID_crl_distribution_points();
708+
static native int getNID_netscape_cert_type();
677709

678710
static native int getBulkCipherAlgorithmEnumNULL();
679711
static native int getBulkCipherAlgorithmEnumRC4();

0 commit comments

Comments
 (0)