« [OCR]パスポート はOCR-B 規格はICAO | トップページ | 【Numbers】pt級数換算表(自分で使っているやつ) »

[AppleScript]SHA-1 ダイジェストを確認

SHA-1 ダイジェストを確認する方法はこちら[LINK]OpenNewWindow
記載された方法です。

SHA-1 ダイジェストを確認する必要性
さほどナーバスになる必要もないけれど
もしも『ホームページが改ざん』されていたり
ファイルが破損していたりする事があります。

それをファイルを開く前に確認する事で
不正なファイルを実行してしまう可能性を潰します。

Apple等も『全てのファイル』に対してSHA-1 ダイジェストは記載していません
セキュリティ上重要と思われるファイルには記載していますので
企業等で管理している場合は
SHA-1 ダイジェストを確認する習慣を身に着けたいものです。

習慣になればさほど面倒でもありません。

 
SHA-1 ダイジェストは↓のように記載されています。

Screencapture00220905_52003



tell application "Finder"
activate
display dialog "SHA 1 digestをペーストしてください" default answer the "1234567890123456789012345678901234567890"
set SHA to text returned of the result as Unicode text
end tell



tell application "Finder"
activate
choose file default location (path to downloads folder) with prompt "ダウンロードしたファイルを選択してください" without multiple selections allowed
set Objresult to the result as alias
----UNIX形式のファイルパスへ変更
set ObjPath to POSIX path of Objresult
end tell


---コマンド
set SHAfile to "/usr/bin/openssl sha1 " & ObjPath as text
---コマンド実行
set SHAfilecom to (do shell script SHAfile without administrator privileges)
----文字数を数える
set CntSHAfilecom to the length of characters of SHAfilecom
set CnttheAlias to the length of characters of ObjPath
---SHAを抜き出す
set SHAfileID to characters (CnttheAlias + 9) thru (CntSHAfilecom) of SHAfilecom as Unicode text

tell application "Finder"
activate
---比較判定
if SHA is equal to SHAfileID then
display dialog "SHA値は一致しました" default answer SHAfilecom
else
display alert "一致しませんでした再度ダウンロードしてください" as warning
end if


end tell

SHA1=16cdbe526165fd9cc8001c1a1444a9f4962cf4d7
「SHA.zip」をダウンロード[LINK]OpenNewWindow

「SHA.html」をダウンロード[LINK]OpenNewWindow

 


シマンテックストア

 

 
  

|

« [OCR]パスポート はOCR-B 規格はICAO | トップページ | 【Numbers】pt級数換算表(自分で使っているやつ) »

Security」カテゴリの記事

コメント

この記事へのコメントは終了しました。