mirror of
				https://github.com/drwetter/testssl.sh.git
				synced 2025-11-04 01:20:59 +01:00 
			
		
		
		
	Merge branch 'no_pkey' of https://github.com/dcooper16/testssl.sh into no_pkey
This commit is contained in:
		
						commit
						96caa6c302
					
				@ -5945,15 +5945,16 @@ get_pub_key_size() {
 | 
				
			|||||||
     local tmppubkeyfile
 | 
					     local tmppubkeyfile
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     # OpenSSL displays the number of bits for RSA and ECC
 | 
					     # OpenSSL displays the number of bits for RSA and ECC
 | 
				
			||||||
     pubkeybits=$($OPENSSL x509 -noout -pubkey -in $HOSTCERT | $OPENSSL pkey -pubin -text | grep -aw "Public-Key:" | sed -e 's/.*(//' -e 's/)//')
 | 
					     pubkeybits=$($OPENSSL x509 -noout -pubkey -in $HOSTCERT | $OPENSSL pkey -pubin -text 2> $ERRFILE | grep -aw "Public-Key:" | sed -e 's/.*(//' -e 's/)//')
 | 
				
			||||||
     if [[ -n $pubkeybits ]]; then
 | 
					     if [[ -n $pubkeybits ]]; then
 | 
				
			||||||
          echo "Server public key is $pubkeybits" >> $TMPFILE
 | 
					          echo "Server public key is $pubkeybits" >> $TMPFILE
 | 
				
			||||||
     else
 | 
					     else
 | 
				
			||||||
          # This extracts the public key for DSA, DH, and GOST
 | 
					          # This extracts the public key for DSA, DH, and GOST
 | 
				
			||||||
          tmppubkeyfile=$(mktemp $TEMPDIR/pubkey.XXXXXX) || return 7
 | 
					          tmppubkeyfile=$(mktemp $TEMPDIR/pubkey.XXXXXX) || return 7
 | 
				
			||||||
          $OPENSSL x509 -noout -pubkey -in $HOSTCERT | $OPENSSL pkey -pubin -outform DER -out "$tmppubkeyfile"
 | 
					          $OPENSSL x509 -noout -pubkey -in $HOSTCERT | $OPENSSL pkey -pubin -outform DER -out "$tmppubkeyfile" 2> $ERRFILE
 | 
				
			||||||
          pubkey=$(hexdump -v -e '16/1 "%02X"' "$tmppubkeyfile")
 | 
					          pubkey=$(hexdump -v -e '16/1 "%02X"' "$tmppubkeyfile")
 | 
				
			||||||
          rm $tmppubkeyfile
 | 
					          rm $tmppubkeyfile
 | 
				
			||||||
 | 
					          [[ -z "$pubkey" ]] && return 1
 | 
				
			||||||
          # Skip over tag and length of subjectPublicKeyInfo
 | 
					          # Skip over tag and length of subjectPublicKeyInfo
 | 
				
			||||||
          i=2
 | 
					          i=2
 | 
				
			||||||
          len1="0x${pubkey:i:2}"
 | 
					          len1="0x${pubkey:i:2}"
 | 
				
			||||||
@ -6038,6 +6039,7 @@ get_pub_key_size() {
 | 
				
			|||||||
          pubkeybits="$(printf "%d" $len)"
 | 
					          pubkeybits="$(printf "%d" $len)"
 | 
				
			||||||
          echo "Server public key is $pubkeybits bit" >> $TMPFILE
 | 
					          echo "Server public key is $pubkeybits bit" >> $TMPFILE
 | 
				
			||||||
     fi
 | 
					     fi
 | 
				
			||||||
 | 
					     return 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# arg1: name of file with socket reply
 | 
					# arg1: name of file with socket reply
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user