shell - How to check a public RSA key file -


I want to verify the public RSA file inside a shell script. What I want to do is that finding a way to check this file is a real public key file, and nothing else.

Can I ask the experts here to verify how I can verify these input files is a real public key file, not a regular file

I have a future I am using this public key file which will use the incoming encrypted encrypted GSIIP file to validate, but it is not yet scope.

I want to check that the input file is valid for the actual RSA public key file is not a simple file. Please note that I do not have any other files with me (examples: private key).

Example: If the file is one ??? Public.pemâ ???? I just want to look inside that this is an actual RSA public key file, not a file with texts or files is corrupt. IA ???? I have already been checking that file Zero size and MD5

I found that other probes that were examined include text â â "BEGIN public key" and < Code> got an "ed public key"? Also found this command in Google, is there a better way to do this openssl

  one ?? openssl rsa-new -text-identical PEM -in pubkey Pam-pub   

thanks

Any public key format parser It is possible to use, including openssl or even the format itself is not as difficult as parse itself.

Once the parsing failed, the command line tools have set a zero-zero exit code:

  openssl RSA -Inarm PEM -pubin -in pubkey.pem -noout & amp; Gt; / Dev / null if [$? ! = 0]; Again, "this was definitely not the public key of RSA in the PM format". To check just a public key:  
  openssl pkey -inform PEM -pubin -in pubkey.pem - No & amp; & Gt; / Dev / null if [$? ! = 0]; Then echo "This was definitely not a public key in the PEM format" exit 1fi    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -