3

Gemalto IDPrime .Net カード Smartcard を使用する必要があります。これらの USB ドングルを取得し、PIN を変更する必要があります。

Gemalto は Windows 経由で次のように言います。

From the Start menu, choose Run and type PINTool.
Insert a IDPrime .Net card in the reader as prompted, and click OK. The change PIN interface appears
Enter the old PIN (the default PIN value is 0000), the new PIN and confirm the new PIN.
Click on Change Pin

http://support.gemalto.com/index.php?id=how_to_change_pin_in_a_idprime#.VWYTWUa8rV8

これは機能しますが、powershell または c# を介して、つまりプログラムの制御下で、新しい PIN/パスワードを設定したいと考えています。それを行う方法または不可能ですか?

4

2 に答える 2

3

私が作成したPkcs11Interopと呼ばれるマネージド .NET ラッパーを使用して、C# から簡単にアクセスできるアンマネージド PKCS#11 API を介して PIN を変更できるはずです。

開始するのに役立つコード サンプルを次に示します。

using Net.Pkcs11Interop.Common;
using Net.Pkcs11Interop.HighLevelAPI;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            // Load PKCS#11 library provided by Gemalto
            using (Pkcs11 pkcs11 = new Pkcs11("gtop11dotnet.dll", true))
            {
                // Find first slot/reader with token/card present
                Slot slot = pkcs11.GetSlotList(true)[0];

                // Open RW session
                using (Session session = slot.OpenSession(false))
                {
                    // Login as normal user with current PIN
                    session.Login(CKU.CKU_USER, "0000");

                    // Set the new pin for the logged in user
                    session.SetPin("0000", "1111");

                    session.Logout();
                }
            }
        }
    }
}
于 2015-05-27T21:11:29.963 に答える
0

@jariq が C# 用に投稿した回答を使用してPowerShellAdmin PIN.

注:これは、IDPrime MD 製品ラインに置き換えられる Gemalto IDPrime .NET カード専用です。詳細については、この投稿の最後を参照してください。

# www.pkcs11interop.net
Add-Type -Path "C:\Somepath\Pkcs11Interop.4.0.0\lib\net45\Pkcs11Interop.dll"

# Gemalto PKCS11 driver
# 1 = single threaded
$pkcs11 = New-Object Net.Pkcs11Interop.HighLevelAPI.Pkcs11("C:\somepath\gtop11dotnet64.dll",1)

# 0 = SlotsType.WithTokenPresent
$slots = $pkcs11.GetSlotList(0)

$slot = $slots[0] # often its the first

# create session
# 1 = SessionType.ReadWrite
$session = $slot.OpenSession(1)

[byte[]]$defaultPIN = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

# 000000000000000000000001
[byte[]]$newPIN = 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31

# 0 = Security Officer a.k.a. Admin
$session.Login(0, $defaultPIN)

$session.SetPin($defaultPIN, $newPIN)

$session.Dispose()
$slot.CloseAllSessions()
$pkcs11.Dispose()

ログインPINしてPIN. 48 桁の管理者 PIN を 24 バイトに変換するために、次の関数が作成されました。

Function Convert-AdminPinToByteArray([Validatepattern("^[0-9A-F]{48}$")][string]$AdminPIN)
{
    $ReturnByte = New-Object byte[] 24

    $n = 0

    for($i=0;$i -lt $ReturnByte.Length;$i++)
    {
        $ReturnByte[$i] = [byte]"0x$($AdminPIN.SubString($n,2))"
        $n = $n + 2
    }

    return $ReturnByte

} # End Function Convert-AdminPinToByteArray

ジェムアルト カードの種類

上記の例は、廃止予定のGemalto IDPrime .NETカードに基づいています。販売終了 (EOS) のお知らせはこちら.

IDPrime .Net
IDPrime .Net バイオ

重要な日程:
マイルストーンの日付
最終購入 (LTB) 2017 年 9 月 29 日
販売終了 (EOS) 2017 年 9 月 30 日
生産終了 (EOL) 2018 年 9 月 30 日

置換

EOS発表PDFによると

製品 ジェムアルトの IDPrime .NET 510/511 スマート カード ファミリは、IDPrime MD 83xおよびIDPrime MD 84xシリーズのスマート カードに置き換えられます。

交換用カードのプログラミング

テスト用に Gemalto IDPrime MD 830 を使用しており、上記の手法が機能しないため、カード タイプの識別に関する情報を含めました。実際、上記の手法を使用すると、カードがリーダーに存在するように表示されることさえありません。

于 2018-03-13T18:50:10.847 に答える