mirror of
				https://github.com/brunoos/luasec.git
				synced 2025-10-31 18:35:33 +01:00 
			
		
		
		
	Add cert:issued(leafcert) for checking chains
This commit is contained in:
		
							
								
								
									
										12
									
								
								src/x509.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/x509.c
									
									
									
									
									
								
							| @@ -393,6 +393,17 @@ static int meth_notafter(lua_State *L) | |||||||
|   return push_asn1_time(L, X509_get_notAfter(cert)); |   return push_asn1_time(L, X509_get_notAfter(cert)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Check if this certificate issued some other certificate | ||||||
|  |  */ | ||||||
|  | static int meth_issued(lua_State *L) | ||||||
|  | { | ||||||
|  |   X509* issuer = lsec_checkx509(L, 1); | ||||||
|  |   X509* subject = lsec_checkx509(L, 2); | ||||||
|  | 	lua_pushboolean(L, X509_check_issued(issuer, subject) == X509_V_OK); | ||||||
|  | 	return 1; | ||||||
|  | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Collect X509 objects. |  * Collect X509 objects. | ||||||
|  */ |  */ | ||||||
| @@ -459,6 +470,7 @@ static luaL_Reg methods[] = { | |||||||
|   {"issuer",     meth_issuer}, |   {"issuer",     meth_issuer}, | ||||||
|   {"notbefore",  meth_notbefore}, |   {"notbefore",  meth_notbefore}, | ||||||
|   {"notafter",   meth_notafter}, |   {"notafter",   meth_notafter}, | ||||||
|  |   {"issued",     meth_issued}, | ||||||
|   {"pem",        meth_pem}, |   {"pem",        meth_pem}, | ||||||
|   {"serial",     meth_serial}, |   {"serial",     meth_serial}, | ||||||
|   {"subject",    meth_subject}, |   {"subject",    meth_subject}, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user