├── CryptokiKeyProvider.cs ├── CryptokiKeyProvider.csproj ├── CryptokiKeyProvider.sln ├── CryptokiKeyProvider.userprefs ├── Forms ├── CkpCreationForm.Designer.cs ├── CkpCreationForm.cs ├── CkpCreationForm.resources ├── CkpCreationForm.resx ├── CkpPromtForm.Designer.cs ├── CkpPromtForm.cs ├── CkpPromtForm.resources └── CkpPromtForm.resx ├── LICENSE ├── Pkcs11.cs ├── Pkcs11Interop ├── AssemblyInfo.cs ├── CHANGELOG.txt ├── Common │ ├── CK.cs │ ├── CKA.cs │ ├── CKC.cs │ ├── CKD.cs │ ├── CKF.cs │ ├── CKG.cs │ ├── CKH.cs │ ├── CKK.cs │ ├── CKM.cs │ ├── CKN.cs │ ├── CKO.cs │ ├── CKP.cs │ ├── CKR.cs │ ├── CKS.cs │ ├── CKU.cs │ ├── CKZ.cs │ ├── ConvertUtils.cs │ └── Pkcs11InteropException.cs ├── HighLevelAPI │ ├── IMechanismParams.cs │ ├── LibraryInfo.cs │ ├── Mechanism.cs │ ├── MechanismFlags.cs │ ├── MechanismInfo.cs │ ├── MechanismParams │ │ ├── CkAesCbcEncryptDataParams.cs │ │ ├── CkAesCtrParams.cs │ │ ├── CkAriaCbcEncryptDataParams.cs │ │ ├── CkCamelliaCbcEncryptDataParams.cs │ │ ├── CkCamelliaCtrParams.cs │ │ ├── CkCmsSigParams.cs │ │ ├── CkDesCbcEncryptDataParams.cs │ │ ├── CkEcdh1DeriveParams.cs │ │ ├── CkEcdh2DeriveParams.cs │ │ ├── CkEcmqvDeriveParams.cs │ │ ├── CkExtractParams.cs │ │ ├── CkKeaDeriveParams.cs │ │ ├── CkKeyDerivationStringData.cs │ │ ├── CkKeyWrapSetOaepParams.cs │ │ ├── CkKipParams.cs │ │ ├── CkMacGeneralParams.cs │ │ ├── CkOtpParam.cs │ │ ├── CkOtpParams.cs │ │ ├── CkOtpSignatureInfo.cs │ │ ├── CkPbeParams.cs │ │ ├── CkPkcs5Pbkd2Params.cs │ │ ├── CkRc2CbcParams.cs │ │ ├── CkRc2MacGeneralParams.cs │ │ ├── CkRc2Params.cs │ │ ├── CkRc5CbcParams.cs │ │ ├── CkRc5MacGeneralParams.cs │ │ ├── CkRc5Params.cs │ │ ├── CkRsaPkcsOaepParams.cs │ │ ├── CkRsaPkcsPssParams.cs │ │ ├── CkSkipjackPrivateWrapParams.cs │ │ ├── CkSkipjackRelayxParams.cs │ │ ├── CkSsl3KeyMatOut.cs │ │ ├── CkSsl3KeyMatParams.cs │ │ ├── CkSsl3MasterKeyDeriveParams.cs │ │ ├── CkSsl3RandomData.cs │ │ ├── CkTlsPrfParams.cs │ │ ├── CkVersion.cs │ │ ├── CkWtlsKeyMatOut.cs │ │ ├── CkWtlsKeyMatParams.cs │ │ ├── CkWtlsMasterKeyDeriveParams.cs │ │ ├── CkWtlsPrfParams.cs │ │ ├── CkWtlsRandomData.cs │ │ ├── CkX942Dh1DeriveParams.cs │ │ ├── CkX942Dh2DeriveParams.cs │ │ └── CkX942MqvDeriveParams.cs │ ├── ObjectAttribute.cs │ ├── ObjectHandle.cs │ ├── Pkcs11.cs │ ├── Pkcs11Exception.cs │ ├── Session.cs │ ├── SessionFlags.cs │ ├── SessionInfo.cs │ ├── Slot.cs │ ├── SlotFlags.cs │ ├── SlotInfo.cs │ ├── TokenFlags.cs │ └── TokenInfo.cs ├── LICENSE.txt ├── LowLevelAPI │ ├── CK_ATTRIBUTE.cs │ ├── CK_C_INITIALIZE_ARGS.cs │ ├── CK_FUNCTION_LIST.cs │ ├── CK_FUNCTION_LIST_UNIX.cs │ ├── CK_INFO.cs │ ├── CK_MECHANISM.cs │ ├── CK_MECHANISM_INFO.cs │ ├── CK_SESSION_INFO.cs │ ├── CK_SLOT_INFO.cs │ ├── CK_TOKEN_INFO.cs │ ├── CK_VERSION.cs │ ├── CkaUtils.cs │ ├── CkmUtils.cs │ ├── Delegates.cs │ ├── MechanismParams │ │ ├── CK_AES_CBC_ENCRYPT_DATA_PARAMS.cs │ │ ├── CK_AES_CTR_PARAMS.cs │ │ ├── CK_ARIA_CBC_ENCRYPT_DATA_PARAMS.cs │ │ ├── CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS.cs │ │ ├── CK_CAMELLIA_CTR_PARAMS.cs │ │ ├── CK_CMS_SIG_PARAMS.cs │ │ ├── CK_DES_CBC_ENCRYPT_DATA_PARAMS.cs │ │ ├── CK_ECDH1_DERIVE_PARAMS.cs │ │ ├── CK_ECDH2_DERIVE_PARAMS.cs │ │ ├── CK_ECMQV_DERIVE_PARAMS.cs │ │ ├── CK_EXTRACT_PARAMS.cs │ │ ├── CK_KEA_DERIVE_PARAMS.cs │ │ ├── CK_KEY_DERIVATION_STRING_DATA.cs │ │ ├── CK_KEY_WRAP_SET_OAEP_PARAMS.cs │ │ ├── CK_KIP_PARAMS.cs │ │ ├── CK_MAC_GENERAL_PARAMS.cs │ │ ├── CK_OTP_PARAM.cs │ │ ├── CK_OTP_PARAMS.cs │ │ ├── CK_OTP_SIGNATURE_INFO.cs │ │ ├── CK_PBE_PARAMS.cs │ │ ├── CK_PKCS5_PBKD2_PARAMS.cs │ │ ├── CK_RC2_CBC_PARAMS.cs │ │ ├── CK_RC2_MAC_GENERAL_PARAMS.cs │ │ ├── CK_RC2_PARAMS.cs │ │ ├── CK_RC5_CBC_PARAMS.cs │ │ ├── CK_RC5_MAC_GENERAL_PARAMS.cs │ │ ├── CK_RC5_PARAMS.cs │ │ ├── CK_RSA_PKCS_OAEP_PARAMS.cs │ │ ├── CK_RSA_PKCS_PSS_PARAMS.cs │ │ ├── CK_SKIPJACK_PRIVATE_WRAP_PARAMS.cs │ │ ├── CK_SKIPJACK_RELAYX_PARAMS.cs │ │ ├── CK_SSL3_KEY_MAT_OUT.cs │ │ ├── CK_SSL3_KEY_MAT_PARAMS.cs │ │ ├── CK_SSL3_MASTER_KEY_DERIVE_PARAMS.cs │ │ ├── CK_SSL3_RANDOM_DATA.cs │ │ ├── CK_TLS_PRF_PARAMS.cs │ │ ├── CK_WTLS_KEY_MAT_OUT.cs │ │ ├── CK_WTLS_KEY_MAT_PARAMS.cs │ │ ├── CK_WTLS_MASTER_KEY_DERIVE_PARAMS.cs │ │ ├── CK_WTLS_PRF_PARAMS.cs │ │ ├── CK_WTLS_RANDOM_DATA.cs │ │ ├── CK_X9_42_DH1_DERIVE_PARAMS.cs │ │ ├── CK_X9_42_DH2_DERIVE_PARAMS.cs │ │ └── CK_X9_42_MQV_DERIVE_PARAMS.cs │ ├── NativeMethods.cs │ ├── Pkcs11.cs │ ├── UnmanagedLibrary.cs │ └── UnmanagedMemory.cs ├── Pkcs11Interop.csproj ├── Pkcs11Interop.pidb ├── app.config └── bin │ └── Debug │ ├── Pkcs11Interop.dll │ ├── Pkcs11Interop.dll.config │ ├── Pkcs11Interop.dll.mdb │ └── Pkcs11Interop.xml ├── Properties ├── AssemblyInfo.cs ├── Settings.Designer.cs └── Settings.settings ├── README.md ├── Resource.Designer.cs ├── Resource.resources ├── Resource.resx ├── Resources └── chip.png ├── bin └── Debug │ ├── CryptokiKeyProvider.dll │ ├── CryptokiKeyProvider.dll.config │ ├── CryptokiKeyProvider.dll.mdb │ ├── KeePass.exe │ ├── KeePass.exe.config │ ├── Pkcs11Interop.dll │ ├── Pkcs11Interop.dll.config │ └── Pkcs11Interop.dll.mdb └── pkcs11.old.cs /CryptokiKeyProvider.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CryptokiKeyProvider", "CryptokiKeyProvider.csproj", "{86B49581-1D6E-4E41-9BBF-E90A7978E07F}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pkcs11Interop", "Pkcs11Interop\Pkcs11Interop.csproj", "{2CB08FA0-8B71-4AE9-8734-BAC10804BF4E}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {2CB08FA0-8B71-4AE9-8734-BAC10804BF4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {2CB08FA0-8B71-4AE9-8734-BAC10804BF4E}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {2CB08FA0-8B71-4AE9-8734-BAC10804BF4E}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {2CB08FA0-8B71-4AE9-8734-BAC10804BF4E}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {86B49581-1D6E-4E41-9BBF-E90A7978E07F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {86B49581-1D6E-4E41-9BBF-E90A7978E07F}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {86B49581-1D6E-4E41-9BBF-E90A7978E07F}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {86B49581-1D6E-4E41-9BBF-E90A7978E07F}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(MonoDevelopProperties) = preSolution 24 | StartupItem = CryptokiKeyProvider.csproj 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /CryptokiKeyProvider.userprefs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Forms/CkpCreationForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nitrokey/nitrokey-keepass-plugin/336249d6ffb439e11346356d1c89b14dd9266f08/Forms/CkpCreationForm.resources -------------------------------------------------------------------------------- /Forms/CkpPromtForm.cs: -------------------------------------------------------------------------------- 1 | /* 2 | CryptokiKeyPrivder - A PKCS#11 Plugin for Keepass 3 | Copyright (C) 2013 Daniel Pieper 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using System.ComponentModel; 22 | using System.Data; 23 | using System.Drawing; 24 | using System.Linq; 25 | using System.Text; 26 | using System.Windows.Forms; 27 | 28 | //using cryptotest; 29 | 30 | using KeePass.UI; 31 | 32 | using KeePassLib.Keys; 33 | using KeePassLib.Utility; 34 | using KeePass.Plugins; 35 | 36 | namespace CryptokiKeyProvider.Forms 37 | { 38 | public partial class CkpPromtForm : Form 39 | { 40 | public string pin; 41 | 42 | public CkpPromtForm() 43 | { 44 | InitializeComponent(); 45 | } 46 | 47 | private void OnFormLoad(object sender, EventArgs e) 48 | { 49 | GlobalWindowManager.AddWindow(this); 50 | 51 | string strTitle = "PKCS#11"; 52 | string strDesc = "Enter your pin."; 53 | 54 | this.Text = strTitle; 55 | BannerFactory.CreateBannerEx(this, banner, 56 | Resource.chip, strTitle, strDesc); 57 | this.textBox1.PasswordChar = '*'; 58 | this.textBox1.Select(); 59 | 60 | } 61 | 62 | private void OnFormClose(Object sender, FormClosingEventArgs e) 63 | { 64 | } 65 | 66 | 67 | private void buttonOk_Click(object sender, EventArgs e) 68 | { 69 | this.pin = this.textBox1.Text; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Forms/CkpPromtForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nitrokey/nitrokey-keepass-plugin/336249d6ffb439e11346356d1c89b14dd9266f08/Forms/CkpPromtForm.resources -------------------------------------------------------------------------------- /Pkcs11Interop/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle("Pkcs11Interop")] 8 | [assembly: AssemblyDescription("Open-source .NET wrapper for unmanaged PKCS#11 libraries")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("JWC s.r.o.")] 11 | [assembly: AssemblyProduct("Pkcs11Interop")] 12 | [assembly: AssemblyCopyright("Copyright (c) 2012-2013 JWC s.r.o. All Rights Reserved.")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion("1.2")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | /*! \mainpage Open-source .NET wrapper for unmanaged PKCS#11 libraries 29 | * 30 | * PKCS#11 is cryptography standard published by RSA Laboratories that defines ANSI C API (called cryptoki) to access smart cards and other types of cryptographic hardware. 31 | * 32 | * Pkcs11interop is open-source project written in C# that brings full power of PKCS#11 API to .NET environment. It uses System.Runtime.InteropServices to define platform invoke methods for accessing unmanaged cryptoki API and specifies how data is marshaled between managed and unmanaged memory. 33 | * 34 | * You should first get familiar with basic concepts of PKCS#11 v2.20 and then start exploring Pkcs11Interop API which resides in Net.Pkcs11Interop namespace and is divided into two logical parts - Net.Pkcs11Interop.LowLevelAPI and Net.Pkcs11Interop.HighLevelAPI. 35 | * 36 | * \section lowlevelapi_sec LowLevelAPI 37 | * 38 | * - Provides exact PKCS#11 interface as defined by RSA Laboratories 39 | * - Gives developer a full power of PKCS#11 ANSI C API 40 | * - Requires C style coding with unmanaged memory management (it is actually quite easy with Net.Pkcs11Interop.LowLevelAPI.UnmanagedMemory class) 41 | * 42 | * Start your exploration of LowLevelAPI by looking at Net.Pkcs11Interop.LowLevelAPI.Pkcs11 class and examples. 43 | * 44 | * \section highlevelapi_sec HighLevelAPI 45 | * 46 | * - It is built on top of LowLevelAPI 47 | * - Utilizes developer friendly constructs and supports streams 48 | * - No unmanaged memory handling is required because garbage collector takes care of everything 49 | * 50 | * Start your exploration of HighLevelAPI by looking at Net.Pkcs11Interop.HighLevelAPI.Pkcs11 class and examples. 51 | * 52 | * Please visit project website - pkcs11interop.net - for more information regarding updates, licensing, support etc. 53 | */ -------------------------------------------------------------------------------- /Pkcs11Interop/CHANGELOG.txt: -------------------------------------------------------------------------------- 1 | Pkcs11Interop 1.2 (21.05.2013) 2 | - Fix #4: Empty string is supported as a value of object attribute 3 | 4 | Pkcs11Interop 1.1 (14.04.2013) 5 | - Fix #1: HighLevelAPI.Slot.SlotId can be 0 6 | 7 | Pkcs11Interop 1.0 (2013-02-02) 8 | - Initial stable release -------------------------------------------------------------------------------- /Pkcs11Interop/Common/CKC.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | namespace Net.Pkcs11Interop.Common 27 | { 28 | /// 29 | /// Certificate types 30 | /// 31 | public enum CKC : uint 32 | { 33 | /// 34 | /// X.509 public key certificate 35 | /// 36 | CKC_X_509 = 0x00000000, 37 | 38 | /// 39 | /// X.509 attribute certificate 40 | /// 41 | CKC_X_509_ATTR_CERT = 0x00000001, 42 | 43 | /// 44 | /// WTLS public key certificate 45 | /// 46 | CKC_WTLS = 0x00000002, 47 | 48 | /// 49 | /// Permanently reserved for token vendors 50 | /// 51 | CKC_VENDOR_DEFINED = 0x80000000 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Pkcs11Interop/Common/CKD.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | namespace Net.Pkcs11Interop.Common 27 | { 28 | /// 29 | /// Key derivation functions 30 | /// 31 | public enum CKD : uint 32 | { 33 | /// 34 | /// Produces a raw shared secret value without applying any key derivation function 35 | /// 36 | CKD_NULL = 0x00000001, 37 | 38 | /// 39 | /// Derives keying data from the shared secret value as defined in ANSI X9.63 40 | /// 41 | CKD_SHA1_KDF = 0x00000002, 42 | 43 | /// 44 | /// Derives keying data from the shared secret value as defined in the ANSI X9.42 standard 45 | /// 46 | CKD_SHA1_KDF_ASN1 = 0x00000003, 47 | 48 | /// 49 | /// Derives keying data from the shared secret value as defined in the ANSI X9.42 standard 50 | /// 51 | CKD_SHA1_KDF_CONCATENATE = 0x00000004 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Pkcs11Interop/Common/CKG.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | namespace Net.Pkcs11Interop.Common 27 | { 28 | /// 29 | /// Mask generation functions 30 | /// 31 | public enum CKG : uint 32 | { 33 | /// 34 | /// PKCS #1 Mask Generation Function with SHA-1 digest algorithm 35 | /// 36 | CKG_MGF1_SHA1 = 0x00000001, 37 | 38 | /// 39 | /// PKCS #1 Mask Generation Function with SHA-256 digest algorithm 40 | /// 41 | CKG_MGF1_SHA256 = 0x00000002, 42 | 43 | /// 44 | /// PKCS #1 Mask Generation Function with SHA-384 digest algorithm 45 | /// 46 | CKG_MGF1_SHA384 = 0x00000003, 47 | 48 | /// 49 | /// PKCS #1 Mask Generation Function with SHA-512 digest algorithm 50 | /// 51 | CKG_MGF1_SHA512 = 0x00000004, 52 | 53 | /// 54 | /// PKCS #1 Mask Generation Function with SHA-224 digest algorithm 55 | /// 56 | CKG_MGF1_SHA224 = 0x00000005 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Pkcs11Interop/Common/CKH.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | namespace Net.Pkcs11Interop.Common 27 | { 28 | /// 29 | /// Hardware feature types 30 | /// 31 | public enum CKH : uint 32 | { 33 | /// 34 | /// Monotonic counter objects represent hardware counters that exist on the device. 35 | /// 36 | CKH_MONOTONIC_COUNTER = 0x00000001, 37 | 38 | /// 39 | /// Clock objects represent real-time clocks that exist on the device. 40 | /// 41 | CKH_CLOCK = 0x00000002, 42 | 43 | /// 44 | /// User interface objects represent the presentation capabilities of the device. 45 | /// 46 | CKH_USER_INTERFACE = 0x00000003, 47 | 48 | /// 49 | /// Permanently reserved for token vendors. 50 | /// 51 | CKH_VENDOR_DEFINED = 0x80000000 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Pkcs11Interop/Common/CKN.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | namespace Net.Pkcs11Interop.Common 27 | { 28 | /// 29 | /// Notifications 30 | /// 31 | public enum CKN : uint 32 | { 33 | /// 34 | /// Cryptoki is surrendering the execution of a function executing in a session so that the application may perform other operations 35 | /// 36 | CKN_SURRENDER = 0, 37 | 38 | /// 39 | /// Cryptoki is informing the application that the OTP for a key on a connected token just changed 40 | /// 41 | CKN_OTP_CHANGED = 1 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Pkcs11Interop/Common/CKO.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | namespace Net.Pkcs11Interop.Common 27 | { 28 | /// 29 | /// Object class 30 | /// 31 | public enum CKO : uint 32 | { 33 | /// 34 | /// Data object that holds information defined by an application. 35 | /// 36 | CKO_DATA = 0x00000000, 37 | 38 | /// 39 | /// Certificate object that holds public-key or attribute certificates. 40 | /// 41 | CKO_CERTIFICATE = 0x00000001, 42 | 43 | /// 44 | /// Public key object that holds public keys. 45 | /// 46 | CKO_PUBLIC_KEY = 0x00000002, 47 | 48 | /// 49 | /// Private key object that holds private keys. 50 | /// 51 | CKO_PRIVATE_KEY = 0x00000003, 52 | 53 | /// 54 | /// Secret key object that holds secret keys. 55 | /// 56 | CKO_SECRET_KEY = 0x00000004, 57 | 58 | /// 59 | /// Hardware feature object that represent features of the device. 60 | /// 61 | CKO_HW_FEATURE = 0x00000005, 62 | 63 | /// 64 | /// Domain parameter object that holds public domain parameters. 65 | /// 66 | CKO_DOMAIN_PARAMETERS = 0x00000006, 67 | 68 | /// 69 | /// Mechanism object that provides information about mechanisms supported by a device beyond that given by the CK_MECHANISM_INFO structure. 70 | /// 71 | CKO_MECHANISM = 0x00000007, 72 | 73 | /// 74 | /// OTP key object that holds secret keys used by OTP tokens. 75 | /// 76 | CKO_OTP_KEY = 0x00000008, 77 | 78 | /// 79 | /// Reserved for token vendors. 80 | /// 81 | CKO_VENDOR_DEFINED = 0x80000000 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Pkcs11Interop/Common/CKP.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | namespace Net.Pkcs11Interop.Common 27 | { 28 | /// 29 | /// Pseudo-random functions 30 | /// 31 | public enum CKP : uint 32 | { 33 | /// 34 | /// PKCS #5 PBKDF2 with HMAC-SHA-1 pseudorandom function 35 | /// 36 | CKP_PKCS5_PBKD2_HMAC_SHA1 = 0x00000001 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Pkcs11Interop/Common/CKS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | namespace Net.Pkcs11Interop.Common 27 | { 28 | /// 29 | /// Session States 30 | /// 31 | public enum CKS : uint 32 | { 33 | /// 34 | /// The application has opened a read-only session. The application has read-only access to public token objects and read/write access to public session objects. 35 | /// 36 | CKS_RO_PUBLIC_SESSION = 0, 37 | 38 | /// 39 | /// The normal user has been authenticated to the token. The application has read-only access to all token objects (public or private) and read/write access to all session objects (public or private). 40 | /// 41 | CKS_RO_USER_FUNCTIONS = 1, 42 | 43 | /// 44 | /// The application has opened a read/write session. The application has read/write access to all public objects. 45 | /// 46 | CKS_RW_PUBLIC_SESSION = 2, 47 | 48 | /// 49 | /// The normal user has been authenticated to the token. The application has read/write access to all objects. 50 | /// 51 | CKS_RW_USER_FUNCTIONS = 3, 52 | 53 | /// 54 | /// The Security Officer has been authenticated to the token. The application has read/write access only to public objects on the token, not to private objects. The SO can set the normal user's PIN. 55 | /// 56 | CKS_RW_SO_FUNCTIONS = 4 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Pkcs11Interop/Common/CKU.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | namespace Net.Pkcs11Interop.Common 27 | { 28 | /// 29 | /// Types of Cryptoki users 30 | /// 31 | public enum CKU : uint 32 | { 33 | /// 34 | /// Security Officer 35 | /// 36 | CKU_SO = 0, 37 | 38 | /// 39 | /// Security Officer 40 | /// 41 | CKU_USER = 1, 42 | 43 | /// 44 | /// Context specific 45 | /// 46 | CKU_CONTEXT_SPECIFIC = 2 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Pkcs11Interop/Common/CKZ.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | namespace Net.Pkcs11Interop.Common 27 | { 28 | /// 29 | /// Salt/Encoding parameter sources 30 | /// 31 | public class CKZ 32 | { 33 | /// 34 | /// PKCS #1 RSA OAEP: Encoding parameter specified 35 | /// 36 | public const uint CKZ_DATA_SPECIFIED = 0x00000001; 37 | 38 | /// 39 | /// PKCS #5 PBKDF2 Key Generation: Salt specified 40 | /// 41 | public const uint CKZ_SALT_SPECIFIED = 0x00000001; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Pkcs11Interop/Common/Pkcs11InteropException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | 28 | namespace Net.Pkcs11Interop.Common 29 | { 30 | /// 31 | /// General purpose exception for Pkcs11Interop project 32 | /// 33 | public class Pkcs11InteropException : Exception 34 | { 35 | /// 36 | /// Initializes a new instance of the Pkcs11InteropException class 37 | /// 38 | public Pkcs11InteropException() 39 | : base() 40 | { 41 | 42 | } 43 | 44 | /// 45 | /// Initializes a new instance of the Pkcs11InteropException class with a specified error message 46 | /// 47 | /// The message that describes the error 48 | public Pkcs11InteropException(string message) 49 | : base(message) 50 | { 51 | 52 | } 53 | 54 | /// 55 | /// Initializes a new instance of the Pkcs11InteropException class with a specified error message and a reference to the inner exception that is the cause of this exception 56 | /// 57 | /// The error message that explains the reason for the exception 58 | /// The exception that is the cause of the current exception, or a null reference if no inner exception is specified. 59 | public Pkcs11InteropException(string message, Exception innerException) 60 | : base(message, innerException) 61 | { 62 | 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/IMechanismParams.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | namespace Net.Pkcs11Interop.HighLevelAPI 27 | { 28 | /// 29 | /// Defines a method to convert high level mechanism parameters to low level mechanism parameters 30 | /// 31 | public interface IMechanismParams 32 | { 33 | /// 34 | /// Converts object to low level mechanism parameters 35 | /// 36 | /// Low level mechanism parameters 37 | object ToLowLevelParams(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/MechanismParams/CkAesCtrParams.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | 28 | namespace Net.Pkcs11Interop.HighLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Parameters for the CKM_AES_CTR mechanism 32 | /// 33 | public class CkAesCtrParams : IMechanismParams 34 | { 35 | /// 36 | /// Low level mechanism parameters 37 | /// 38 | private LowLevelAPI.MechanismParams.CK_AES_CTR_PARAMS _lowLevelStruct = new LowLevelAPI.MechanismParams.CK_AES_CTR_PARAMS(); 39 | 40 | /// 41 | /// Initializes a new instance of the CkAesCtrParams class. 42 | /// 43 | /// The number of bits in the counter block (cb) that shall be incremented 44 | /// Specifies the counter block (16 bytes) 45 | public CkAesCtrParams(uint counterBits, byte[] cb) 46 | { 47 | _lowLevelStruct.CounterBits = 0; 48 | _lowLevelStruct.Cb = new byte[16]; 49 | 50 | _lowLevelStruct.CounterBits = counterBits; 51 | 52 | if (cb == null) 53 | throw new ArgumentNullException("cb"); 54 | 55 | if (cb.Length != 16) 56 | throw new ArgumentOutOfRangeException("cb", "Array has to be 16 bytes long"); 57 | 58 | Array.Copy(cb, _lowLevelStruct.Cb, cb.Length); 59 | } 60 | 61 | #region IMechanismParams 62 | 63 | /// 64 | /// Converts object to low level mechanism parameters 65 | /// 66 | /// Low level mechanism parameters 67 | public object ToLowLevelParams() 68 | { 69 | return _lowLevelStruct; 70 | } 71 | 72 | #endregion 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/MechanismParams/CkCamelliaCtrParams.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | 28 | namespace Net.Pkcs11Interop.HighLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Parameters for the CKM_CAMELLIA_CTR mechanism 32 | /// 33 | public class CkCamelliaCtrParams : IMechanismParams 34 | { 35 | /// 36 | /// Low level mechanism parameters 37 | /// 38 | private LowLevelAPI.MechanismParams.CK_CAMELLIA_CTR_PARAMS _lowLevelStruct = new LowLevelAPI.MechanismParams.CK_CAMELLIA_CTR_PARAMS(); 39 | 40 | /// 41 | /// Initializes a new instance of the CkCamelliaCtrParams class. 42 | /// 43 | /// The number of bits in the counter block (cb) that shall be incremented 44 | /// Specifies the counter block (16 bytes) 45 | public CkCamelliaCtrParams(uint counterBits, byte[] cb) 46 | { 47 | _lowLevelStruct.CounterBits = 0; 48 | _lowLevelStruct.Cb = new byte[16]; 49 | 50 | _lowLevelStruct.CounterBits = counterBits; 51 | 52 | if (cb == null) 53 | throw new ArgumentNullException("cb"); 54 | 55 | if (cb.Length != 16) 56 | throw new ArgumentOutOfRangeException("cb", "Array has to be 16 bytes long"); 57 | 58 | Array.Copy(cb, _lowLevelStruct.Cb, cb.Length); 59 | } 60 | 61 | #region IMechanismParams 62 | 63 | /// 64 | /// Converts object to low level mechanism parameters 65 | /// 66 | /// Low level mechanism parameters 67 | public object ToLowLevelParams() 68 | { 69 | return _lowLevelStruct; 70 | } 71 | 72 | #endregion 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/MechanismParams/CkExtractParams.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | 28 | namespace Net.Pkcs11Interop.HighLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Parameters for the CKM_EXTRACT_KEY_FROM_KEY mechanism 32 | /// 33 | public class CkExtractParams : IMechanismParams 34 | { 35 | /// 36 | /// Low level mechanism parameters 37 | /// 38 | private LowLevelAPI.MechanismParams.CK_EXTRACT_PARAMS _lowLevelStruct = new LowLevelAPI.MechanismParams.CK_EXTRACT_PARAMS(); 39 | 40 | /// 41 | /// Initializes a new instance of the CkExtractParams class. 42 | /// 43 | /// Specifies which bit of the base key should be used as the first bit of the derived key 44 | public CkExtractParams(uint bit) 45 | { 46 | _lowLevelStruct.Bit = bit; 47 | } 48 | 49 | #region IMechanismParams 50 | 51 | /// 52 | /// Converts object to low level mechanism parameters 53 | /// 54 | /// Low level mechanism parameters 55 | public object ToLowLevelParams() 56 | { 57 | return _lowLevelStruct; 58 | } 59 | 60 | #endregion 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/MechanismParams/CkMacGeneralParams.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | 28 | namespace Net.Pkcs11Interop.HighLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Parameters for the general-length MACing mechanisms (DES, DES3, CAST, CAST3, CAST128 (CAST5), IDEA, CDMF and AES), the general length HMACing mechanisms (MD2, MD5, SHA-1, SHA-256, SHA-384, SHA-512, RIPEMD-128 and RIPEMD-160) and the two SSL 3.0 MACing mechanisms (MD5 and SHA-1) 32 | /// 33 | public class CkMacGeneralParams : IMechanismParams 34 | { 35 | /// 36 | /// Low level mechanism parameters 37 | /// 38 | private LowLevelAPI.MechanismParams.CK_MAC_GENERAL_PARAMS _lowLevelStruct = new LowLevelAPI.MechanismParams.CK_MAC_GENERAL_PARAMS(); 39 | 40 | /// 41 | /// Initializes a new instance of the CkMacGeneralParams class. 42 | /// 43 | /// Length of the MAC produced, in bytes 44 | public CkMacGeneralParams(uint macLength) 45 | { 46 | _lowLevelStruct.MacLength = macLength; 47 | } 48 | 49 | #region IMechanismParams 50 | 51 | /// 52 | /// Converts object to low level mechanism parameters 53 | /// 54 | /// Low level mechanism parameters 55 | public object ToLowLevelParams() 56 | { 57 | return _lowLevelStruct; 58 | } 59 | 60 | #endregion 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/MechanismParams/CkRc2CbcParams.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | 28 | namespace Net.Pkcs11Interop.HighLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Parameters for the CKM_RC2_CBC and CKM_RC2_CBC_PAD mechanisms 32 | /// 33 | public class CkRc2CbcParams : IMechanismParams 34 | { 35 | /// 36 | /// Low level mechanism parameters 37 | /// 38 | private LowLevelAPI.MechanismParams.CK_RC2_CBC_PARAMS _lowLevelStruct = new LowLevelAPI.MechanismParams.CK_RC2_CBC_PARAMS(); 39 | 40 | /// 41 | /// Initializes a new instance of the CkRc2CbcParams class. 42 | /// 43 | /// The effective number of bits in the RC2 search space 44 | /// The initialization vector (IV) for cipher block chaining mode 45 | public CkRc2CbcParams(uint effectiveBits, byte[] iv) 46 | { 47 | _lowLevelStruct.EffectiveBits = 0; 48 | _lowLevelStruct.Iv = new byte[8]; 49 | 50 | _lowLevelStruct.EffectiveBits = effectiveBits; 51 | 52 | if (iv == null) 53 | throw new ArgumentNullException("iv"); 54 | 55 | if (iv.Length != 8) 56 | throw new ArgumentOutOfRangeException("iv", "Array has to be 8 bytes long"); 57 | 58 | Array.Copy(iv, _lowLevelStruct.Iv, iv.Length); 59 | } 60 | 61 | #region IMechanismParams 62 | 63 | /// 64 | /// Converts object to low level mechanism parameters 65 | /// 66 | /// Low level mechanism parameters 67 | public object ToLowLevelParams() 68 | { 69 | return _lowLevelStruct; 70 | } 71 | 72 | #endregion 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/MechanismParams/CkRc2MacGeneralParams.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | 28 | namespace Net.Pkcs11Interop.HighLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Parameters for the CKM_RC2_MAC_GENERAL mechanism 32 | /// 33 | public class CkRc2MacGeneralParams : IMechanismParams 34 | { 35 | /// 36 | /// Low level mechanism parameters 37 | /// 38 | private LowLevelAPI.MechanismParams.CK_RC2_MAC_GENERAL_PARAMS _lowLevelStruct = new LowLevelAPI.MechanismParams.CK_RC2_MAC_GENERAL_PARAMS(); 39 | 40 | /// 41 | /// Initializes a new instance of the CkRc2MacGeneralParams class. 42 | /// 43 | /// The effective number of bits in the RC2 search space 44 | /// Length of the MAC produced, in bytes 45 | public CkRc2MacGeneralParams(uint effectiveBits, uint macLength) 46 | { 47 | _lowLevelStruct.EffectiveBits = effectiveBits; 48 | _lowLevelStruct.MacLength = macLength; 49 | } 50 | 51 | #region IMechanismParams 52 | 53 | /// 54 | /// Converts object to low level mechanism parameters 55 | /// 56 | /// Low level mechanism parameters 57 | public object ToLowLevelParams() 58 | { 59 | return _lowLevelStruct; 60 | } 61 | 62 | #endregion 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/MechanismParams/CkRc2Params.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | 28 | namespace Net.Pkcs11Interop.HighLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Parameters for the CKM_RC2_ECB and CKM_RC2_MAC mechanisms 32 | /// 33 | public class CkRc2Params : IMechanismParams 34 | { 35 | /// 36 | /// Low level mechanism parameters 37 | /// 38 | private LowLevelAPI.MechanismParams.CK_RC2_PARAMS _lowLevelStruct = new LowLevelAPI.MechanismParams.CK_RC2_PARAMS(); 39 | 40 | /// 41 | /// Initializes a new instance of the CkRc2Params class. 42 | /// 43 | /// Effective number of bits in the RC2 search space 44 | public CkRc2Params(uint effectiveBits) 45 | { 46 | _lowLevelStruct.EffectiveBits = effectiveBits; 47 | } 48 | 49 | #region IMechanismParams 50 | 51 | /// 52 | /// Converts object to low level mechanism parameters 53 | /// 54 | /// Low level mechanism parameters 55 | public object ToLowLevelParams() 56 | { 57 | return _lowLevelStruct; 58 | } 59 | 60 | #endregion 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/MechanismParams/CkRc5MacGeneralParams.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | 28 | namespace Net.Pkcs11Interop.HighLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Parameters for the CKM_RC5_MAC_GENERAL mechanism 32 | /// 33 | public class CkRc5MacGeneralParams : IMechanismParams 34 | { 35 | /// 36 | /// Low level mechanism parameters 37 | /// 38 | private LowLevelAPI.MechanismParams.CK_RC5_MAC_GENERAL_PARAMS _lowLevelStruct = new LowLevelAPI.MechanismParams.CK_RC5_MAC_GENERAL_PARAMS(); 39 | 40 | /// 41 | /// Initializes a new instance of the CkRc5MacGeneralParams class. 42 | /// 43 | /// Wordsize of RC5 cipher in bytes 44 | /// Number of rounds of RC5 encipherment 45 | /// Length of the MAC produced, in bytes 46 | public CkRc5MacGeneralParams(uint wordsize, uint rounds, uint macLength) 47 | { 48 | _lowLevelStruct.Wordsize = wordsize; 49 | _lowLevelStruct.Rounds = rounds; 50 | _lowLevelStruct.MacLength = macLength; 51 | } 52 | 53 | #region IMechanismParams 54 | 55 | /// 56 | /// Converts object to low level mechanism parameters 57 | /// 58 | /// Low level mechanism parameters 59 | public object ToLowLevelParams() 60 | { 61 | return _lowLevelStruct; 62 | } 63 | 64 | #endregion 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/MechanismParams/CkRc5Params.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | 28 | namespace Net.Pkcs11Interop.HighLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Parameters for the CKM_RC5_ECB and CKM_RC5_MAC mechanisms 32 | /// 33 | public class CkRc5Params : IMechanismParams 34 | { 35 | /// 36 | /// Low level mechanism parameters 37 | /// 38 | private LowLevelAPI.MechanismParams.CK_RC5_PARAMS _lowLevelStruct = new LowLevelAPI.MechanismParams.CK_RC5_PARAMS(); 39 | 40 | /// 41 | /// Initializes a new instance of the CkRc5Params class. 42 | /// 43 | /// Wordsize of RC5 cipher in bytes 44 | /// Number of rounds of RC5 encipherment 45 | public CkRc5Params(uint wordsize, uint rounds) 46 | { 47 | _lowLevelStruct.Wordsize = wordsize; 48 | _lowLevelStruct.Rounds = rounds; 49 | } 50 | 51 | #region IMechanismParams 52 | 53 | /// 54 | /// Converts object to low level mechanism parameters 55 | /// 56 | /// Low level mechanism parameters 57 | public object ToLowLevelParams() 58 | { 59 | return _lowLevelStruct; 60 | } 61 | 62 | #endregion 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/MechanismParams/CkRsaPkcsPssParams.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | 28 | namespace Net.Pkcs11Interop.HighLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Parameters for the CKM_RSA_PKCS_PSS mechanism 32 | /// 33 | public class CkRsaPkcsPssParams : IMechanismParams 34 | { 35 | /// 36 | /// Low level mechanism parameters 37 | /// 38 | private LowLevelAPI.MechanismParams.CK_RSA_PKCS_PSS_PARAMS _lowLevelStruct = new LowLevelAPI.MechanismParams.CK_RSA_PKCS_PSS_PARAMS(); 39 | 40 | /// 41 | /// Initializes a new instance of the CkRsaPkcsPssParams class. 42 | /// 43 | /// Hash algorithm used in the PSS encoding (CKM) 44 | /// Mask generation function to use on the encoded block (CKG) 45 | /// Length, in bytes, of the salt value used in the PSS encoding 46 | public CkRsaPkcsPssParams(uint hashAlg, uint mgf, uint len) 47 | { 48 | _lowLevelStruct.HashAlg = hashAlg; 49 | _lowLevelStruct.Mgf = mgf; 50 | _lowLevelStruct.Len = len; 51 | } 52 | 53 | #region IMechanismParams 54 | 55 | /// 56 | /// Converts object to low level mechanism parameters 57 | /// 58 | /// Low level mechanism parameters 59 | public object ToLowLevelParams() 60 | { 61 | return _lowLevelStruct; 62 | } 63 | 64 | #endregion 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/MechanismParams/CkVersion.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using Net.Pkcs11Interop.Common; 28 | 29 | namespace Net.Pkcs11Interop.HighLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Parameters for the CKM_SSL3_PRE_MASTER_KEY_GEN mechanism 33 | /// 34 | public class CkVersion : IMechanismParams 35 | { 36 | /// 37 | /// Low level mechanism parameters 38 | /// 39 | private LowLevelAPI.CK_VERSION _lowLevelStruct = new LowLevelAPI.CK_VERSION(); 40 | 41 | /// 42 | /// Major version number (the integer portion of the version) 43 | /// 44 | public byte Major 45 | { 46 | get 47 | { 48 | return _lowLevelStruct.Major[0]; 49 | } 50 | } 51 | 52 | /// 53 | /// Minor version number (the hundredths portion of the version) 54 | /// 55 | public byte Minor 56 | { 57 | get 58 | { 59 | return _lowLevelStruct.Minor[0]; 60 | } 61 | } 62 | 63 | /// 64 | /// Initializes a new instance of the CkVersion class. 65 | /// 66 | /// Major version number (the integer portion of the version) 67 | /// Minor version number (the hundredths portion of the version) 68 | public CkVersion(byte major, byte minor) 69 | { 70 | _lowLevelStruct.Major = new byte[] { major }; 71 | _lowLevelStruct.Minor = new byte[] { minor }; 72 | } 73 | 74 | #region IMechanismParams 75 | 76 | /// 77 | /// Converts object to low level mechanism parameters 78 | /// 79 | /// Low level mechanism parameters 80 | public object ToLowLevelParams() 81 | { 82 | return _lowLevelStruct; 83 | } 84 | 85 | #endregion 86 | 87 | /// 88 | /// Returns a string that represents the current CkVersion object. 89 | /// 90 | /// String that represents the current CkVersion object. 91 | public override string ToString() 92 | { 93 | return ConvertUtils.CkVersionToString(_lowLevelStruct); 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/ObjectHandle.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using Net.Pkcs11Interop.Common; 27 | 28 | namespace Net.Pkcs11Interop.HighLevelAPI 29 | { 30 | /// 31 | /// Token-specific identifier for an object 32 | /// 33 | public class ObjectHandle 34 | { 35 | /// 36 | /// PKCS#11 handle of object 37 | /// 38 | private uint _objectId = CK.CK_INVALID_HANDLE; 39 | 40 | /// 41 | /// PKCS#11 handle of object 42 | /// 43 | public uint ObjectId 44 | { 45 | get 46 | { 47 | return _objectId; 48 | } 49 | } 50 | 51 | /// 52 | /// Initializes new instance of ObjectHandle class with ObjectId set to CK_INVALID_HANDLE 53 | /// 54 | public ObjectHandle() 55 | { 56 | _objectId = CK.CK_INVALID_HANDLE; 57 | } 58 | 59 | /// 60 | /// Initializes new instance of ObjectHandle class 61 | /// 62 | /// PKCS#11 handle of object 63 | public ObjectHandle(uint objectId) 64 | { 65 | _objectId = objectId; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/Pkcs11Exception.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using Net.Pkcs11Interop.Common; 28 | 29 | namespace Net.Pkcs11Interop.HighLevelAPI 30 | { 31 | /// 32 | /// Exception with the name of PKCS#11 method that failed and its return value 33 | /// 34 | public class Pkcs11Exception : Exception 35 | { 36 | /// 37 | /// Name of method that caused exception 38 | /// 39 | private string _method = null; 40 | 41 | /// 42 | /// Name of method that caused exception 43 | /// 44 | public string Method 45 | { 46 | get 47 | { 48 | return _method; 49 | } 50 | } 51 | 52 | /// 53 | /// Return value of method that caused exception 54 | /// 55 | private CKR _rv = CKR.CKR_OK; 56 | 57 | /// 58 | /// Return value of method that caused exception 59 | /// 60 | public CKR RV 61 | { 62 | get 63 | { 64 | return _rv; 65 | } 66 | } 67 | 68 | /// 69 | /// Initializes new instance of Pkcs11Exception class 70 | /// 71 | /// Name of method that caused exception 72 | /// Return value of method that caused exception 73 | public Pkcs11Exception(string method, CKR rv) 74 | : base(string.Format("Method {0} returned {1}", method, rv.ToString())) 75 | { 76 | _method = method; 77 | _rv = rv; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/SessionFlags.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using Net.Pkcs11Interop.Common; 27 | 28 | namespace Net.Pkcs11Interop.HighLevelAPI 29 | { 30 | /// 31 | /// Flags that define the type of session 32 | /// 33 | public class SessionFlags 34 | { 35 | /// 36 | /// Bit flags that define the type of session 37 | /// 38 | private uint _flags; 39 | 40 | /// 41 | /// Bit flags that define the type of session 42 | /// 43 | public uint Flags 44 | { 45 | get 46 | { 47 | return _flags; 48 | } 49 | } 50 | 51 | /// 52 | /// True if the session is read/write; false if the session is read-only 53 | /// 54 | public bool RwSession 55 | { 56 | get 57 | { 58 | return ((_flags & CKF.CKF_RW_SESSION) == CKF.CKF_RW_SESSION); 59 | } 60 | } 61 | 62 | /// 63 | /// This flag is provided for backward compatibility, and should always be set to true 64 | /// 65 | public bool SerialSession 66 | { 67 | get 68 | { 69 | return ((_flags & CKF.CKF_SERIAL_SESSION) == CKF.CKF_SERIAL_SESSION); 70 | } 71 | } 72 | 73 | /// 74 | /// Initializes new instance of SessionFlags class 75 | /// 76 | /// Bit flags that define the type of session 77 | internal SessionFlags(uint flags) 78 | { 79 | _flags = flags; 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Pkcs11Interop/HighLevelAPI/SlotFlags.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using Net.Pkcs11Interop.Common; 27 | 28 | namespace Net.Pkcs11Interop.HighLevelAPI 29 | { 30 | /// 31 | /// Flags that provide capabilities of the slot 32 | /// 33 | public class SlotFlags 34 | { 35 | /// 36 | /// Bits flags that provide capabilities of the slot 37 | /// 38 | private uint _flags; 39 | 40 | /// 41 | /// Bits flags that provide capabilities of the slot 42 | /// 43 | public uint Flags 44 | { 45 | get 46 | { 47 | return _flags; 48 | } 49 | } 50 | 51 | /// 52 | /// True if a token is present in the slot (e.g. a device is in the reader) 53 | /// 54 | public bool TokenPresent 55 | { 56 | get 57 | { 58 | return ((_flags & CKF.CKF_TOKEN_PRESENT) == CKF.CKF_TOKEN_PRESENT); 59 | } 60 | } 61 | 62 | /// 63 | /// True if the reader supports removable devices 64 | /// 65 | public bool RemovableDevice 66 | { 67 | get 68 | { 69 | return ((_flags & CKF.CKF_REMOVABLE_DEVICE) == CKF.CKF_REMOVABLE_DEVICE); 70 | } 71 | } 72 | 73 | /// 74 | /// True if the slot is a hardware slot, as opposed to a software slot implementing a "soft token" 75 | /// 76 | public bool HardwareSlot 77 | { 78 | get 79 | { 80 | return ((_flags & CKF.CKF_HW_SLOT) == CKF.CKF_HW_SLOT); 81 | } 82 | } 83 | 84 | /// 85 | /// Initializes new instance of SlotFlags class 86 | /// 87 | /// Bits flags that provide capabilities of the slot 88 | internal SlotFlags(uint flags) 89 | { 90 | _flags = flags; 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Pkcs11Interop/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 2 | Copyright (c) 2012-2013 JWC s.r.o. 3 | Author: Jaroslav Imrich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License version 3 7 | as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Affero General Public License for more details. 13 | 14 | You should have received a copy of the GNU Affero General Public License 15 | along with this program. If not, see . 16 | 17 | You can be released from the requirements of the license by purchasing 18 | a commercial license. Buying such a license is mandatory as soon as you 19 | develop commercial activities involving the Pkcs11Interop software without 20 | disclosing the source code of your own applications. 21 | 22 | For more information, please contact JWC s.r.o. at info@pkcs11interop.net 23 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/CK_ATTRIBUTE.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI 30 | { 31 | /// 32 | /// Defines the type, value, and length of an attribute 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_ATTRIBUTE 36 | { 37 | /// 38 | /// The attribute type 39 | /// 40 | public uint type; 41 | 42 | /// 43 | /// Pointer to the value of the attribute 44 | /// 45 | public IntPtr value; 46 | 47 | /// 48 | /// Length in bytes of the value 49 | /// 50 | public uint valueLen; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/CK_C_INITIALIZE_ARGS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI 30 | { 31 | /// 32 | /// Optional arguments for the C_Initialize function 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public class CK_C_INITIALIZE_ARGS 36 | { 37 | /// 38 | /// Pointer to a function to use for creating mutex objects (not supported by Pkcs11Interop) 39 | /// 40 | public IntPtr CreateMutex = IntPtr.Zero; 41 | 42 | /// 43 | /// Pointer to a function to use for destroying mutex objects (not supported by Pkcs11Interop) 44 | /// 45 | public IntPtr DestroyMutex = IntPtr.Zero; 46 | 47 | /// 48 | /// Pointer to a function to use for locking mutex objects (not supported by Pkcs11Interop) 49 | /// 50 | public IntPtr LockMutex = IntPtr.Zero; 51 | 52 | /// 53 | /// Pointer to a function to use for unlocking mutex objects (not supported by Pkcs11Interop) 54 | /// 55 | public IntPtr UnlockMutex = IntPtr.Zero; 56 | 57 | /// 58 | /// Bit flags specifying options 59 | /// 60 | public uint Flags = 0; 61 | 62 | /// 63 | /// Reserved for future use 64 | /// 65 | public IntPtr Reserved = IntPtr.Zero; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/CK_INFO.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI 29 | { 30 | /// 31 | /// Provides general information about Cryptoki 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_INFO 35 | { 36 | /// 37 | /// Cryptoki interface version number, for compatibility with future revisions of this interface. 38 | /// 39 | public CK_VERSION CryptokiVersion; 40 | 41 | /// 42 | /// ID of the Cryptoki library manufacturer. Must be padded with the blank character (‘ ‘). Should not be null-terminated. 43 | /// 44 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] 45 | public byte[] ManufacturerId; 46 | 47 | /// 48 | /// Bit flags reserved for future versions. Must be zero for this version 49 | /// 50 | public uint Flags; 51 | 52 | /// 53 | /// Character-string description of the library. Must be padded with the blank character (‘ ‘). Should not be null-terminated. 54 | /// 55 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] 56 | public byte[] LibraryDescription; 57 | 58 | /// 59 | /// Cryptoki library version number 60 | /// 61 | public CK_VERSION LibraryVersion; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/CK_MECHANISM.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI 30 | { 31 | /// 32 | /// Specifies a particular mechanism and any parameters it requires 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_MECHANISM 36 | { 37 | /// 38 | /// The type of mechanism 39 | /// 40 | public uint Mechanism; 41 | 42 | /// 43 | /// Pointer to the parameter if required by the mechanism 44 | /// 45 | public IntPtr Parameter; 46 | 47 | /// 48 | /// Length of the parameter in bytes 49 | /// 50 | public uint ParameterLen; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/CK_MECHANISM_INFO.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI 29 | { 30 | /// 31 | /// Provides information about a particular mechanism 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_MECHANISM_INFO 35 | { 36 | /// 37 | /// The minimum size of the key for the mechanism (whether this is measured in bits or in bytes is mechanism-dependent) 38 | /// 39 | public uint MinKeySize; 40 | 41 | /// 42 | /// The maximum size of the key for the mechanism (whether this is measured in bits or in bytes is mechanism-dependent) 43 | /// 44 | public uint MaxKeySize; 45 | 46 | /// 47 | /// Bit flags specifying mechanism capabilities 48 | /// 49 | public uint Flags; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/CK_SESSION_INFO.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI 29 | { 30 | /// 31 | /// Information about a session 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_SESSION_INFO 35 | { 36 | /// 37 | /// ID of the slot that interfaces with the token 38 | /// 39 | public uint SlotId; 40 | 41 | /// 42 | /// The state of the session 43 | /// 44 | public uint State; 45 | 46 | /// 47 | /// Bit flags that define the type of session 48 | /// 49 | public uint Flags; 50 | 51 | /// 52 | /// An error code defined by the cryptographic device. Used for errors not covered by Cryptoki. 53 | /// 54 | public uint DeviceError; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/CK_SLOT_INFO.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI 29 | { 30 | /// 31 | /// Provides information about a slot 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_SLOT_INFO 35 | { 36 | /// 37 | /// Character-string description of the slot. Must be padded with the blank character (‘ ‘). Should not be null-terminated. 38 | /// 39 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] 40 | public byte[] SlotDescription; 41 | 42 | /// 43 | /// ID of the slot manufacturer. Must be padded with the blank character (‘ ‘). Should not be null-terminated. 44 | /// 45 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] 46 | public byte[] ManufacturerId; 47 | 48 | /// 49 | /// Bits flags that provide capabilities of the slot. 50 | /// 51 | public uint Flags; 52 | 53 | /// 54 | /// Version number of the slot's hardware 55 | /// 56 | public CK_VERSION HardwareVersion; 57 | 58 | /// 59 | /// Version number of the slot's firmware 60 | /// 61 | public CK_VERSION FirmwareVersion; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/CK_VERSION.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI 29 | { 30 | /// 31 | /// Describes the version 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_VERSION 35 | { 36 | /// 37 | /// Major version number (the integer portion of the version) 38 | /// 39 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] 40 | public byte[] Major; 41 | 42 | /// 43 | /// Minor version number (the hundredths portion of the version) 44 | /// 45 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] 46 | public byte[] Minor; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_AES_CBC_ENCRYPT_DATA_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_AES_CBC_ENCRYPT_DATA mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_AES_CBC_ENCRYPT_DATA_PARAMS 36 | { 37 | /// 38 | /// IV value 39 | /// 40 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] 41 | public byte[] Iv; 42 | 43 | /// 44 | /// Data value part that must be a multiple of 16 bytes long 45 | /// 46 | public IntPtr Data; 47 | 48 | /// 49 | /// Length of data in bytes 50 | /// 51 | public uint Length; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_AES_CTR_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Structure that provides the parameters to the CKM_AES_CTR mechanism 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_AES_CTR_PARAMS 35 | { 36 | /// 37 | /// The number of bits in the counter block (cb) that shall be incremented 38 | /// 39 | public uint CounterBits; 40 | 41 | /// 42 | /// Specifies the counter block 43 | /// 44 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] 45 | public byte[] Cb; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_ARIA_CBC_ENCRYPT_DATA_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_ARIA_CBC_ENCRYPT_DATA mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS 36 | { 37 | /// 38 | /// 16-octet initialization vector 39 | /// 40 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] 41 | public byte[] Iv; 42 | 43 | /// 44 | /// Pointer to data to encrypt 45 | /// 46 | public IntPtr Data; 47 | 48 | /// 49 | /// Length of data to encrypt 50 | /// 51 | public uint Length; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_CAMELLIA_CBC_ENCRYPT_DATA mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS 36 | { 37 | /// 38 | /// 16-octet initialization vector 39 | /// 40 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] 41 | public byte[] Iv; 42 | 43 | /// 44 | /// Pointer to data to encrypt 45 | /// 46 | public IntPtr Data; 47 | 48 | /// 49 | /// Length of data to encrypt 50 | /// 51 | public uint Length; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_CAMELLIA_CTR_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Structure that provides the parameters to the CKM_CAMELLIA_CTR mechanism 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_CAMELLIA_CTR_PARAMS 35 | { 36 | /// 37 | /// Specifies the number of bits in the counter block (cb) that shall be incremented 38 | /// 39 | public uint CounterBits; 40 | 41 | /// 42 | /// Specifies the counter block 43 | /// 44 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] 45 | public byte[] Cb; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_CMS_SIG_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_CMS_SIG mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_CMS_SIG_PARAMS 36 | { 37 | /// 38 | /// Object handle for a certificate associated with the signing key 39 | /// 40 | public uint CertificateHandle; 41 | 42 | /// 43 | /// Mechanism to use when signing a constructed CMS SignedAttributes value 44 | /// 45 | public IntPtr SigningMechanism; 46 | 47 | /// 48 | /// Mechanism to use when digesting the data 49 | /// 50 | public IntPtr DigestMechanism; 51 | 52 | /// 53 | /// NULL-terminated string indicating complete MIME Content-type of message to be signed or null if the message is a MIME object 54 | /// 55 | public IntPtr ContentType; 56 | 57 | /// 58 | /// Pointer to DER-encoded list of CMS Attributes the caller requests to be included in the signed attributes 59 | /// 60 | public IntPtr RequestedAttributes; 61 | 62 | /// 63 | /// Length in bytes of the value pointed to by RequestedAttributes 64 | /// 65 | public uint RequestedAttributesLen; 66 | 67 | /// 68 | /// Pointer to DER-encoded list of CMS Attributes (with accompanying values) required to be included in the resulting signed attributes 69 | /// 70 | public IntPtr RequiredAttributes; 71 | 72 | /// 73 | /// Length in bytes, of the value pointed to by RequiredAttributes 74 | /// 75 | public uint RequiredAttributesLen; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_DES_CBC_ENCRYPT_DATA_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_DES_CBC_ENCRYPT_DATA and CKM_DES3_CBC_ENCRYPT_DATA mechanisms 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_DES_CBC_ENCRYPT_DATA_PARAMS 36 | { 37 | /// 38 | /// IV value 39 | /// 40 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] 41 | public byte[] Iv; 42 | 43 | /// 44 | /// Data value part that must be a multiple of 8 bytes long 45 | /// 46 | public IntPtr Data; 47 | 48 | /// 49 | /// Length of data in bytes 50 | /// 51 | public uint Length; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_ECDH1_DERIVE_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters for the CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE key derivation mechanisms 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_ECDH1_DERIVE_PARAMS 36 | { 37 | /// 38 | /// Key derivation function used on the shared secret value (CKD) 39 | /// 40 | public uint Kdf; 41 | 42 | /// 43 | /// The length in bytes of the shared info 44 | /// 45 | public uint SharedDataLen; 46 | 47 | /// 48 | /// Some data shared between the two parties 49 | /// 50 | public IntPtr SharedData; 51 | 52 | /// 53 | /// The length in bytes of the other party's EC public key 54 | /// 55 | public uint PublicDataLen; 56 | 57 | /// 58 | /// Pointer to other party's EC public key value 59 | /// 60 | public IntPtr PublicData; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_ECDH2_DERIVE_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_ECMQV_DERIVE mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_ECDH2_DERIVE_PARAMS 36 | { 37 | /// 38 | /// Key derivation function used on the shared secret value (CKD) 39 | /// 40 | public uint Kdf; 41 | 42 | /// 43 | /// The length in bytes of the shared info 44 | /// 45 | public uint SharedDataLen; 46 | 47 | /// 48 | /// Some data shared between the two parties 49 | /// 50 | public IntPtr SharedData; 51 | 52 | /// 53 | /// The length in bytes of the other party's first EC public key 54 | /// 55 | public uint PublicDataLen; 56 | 57 | /// 58 | /// Pointer to other party's first EC public key value 59 | /// 60 | public IntPtr PublicData; 61 | 62 | /// 63 | /// The length in bytes of the second EC private key 64 | /// 65 | public uint PrivateDataLen; 66 | 67 | /// 68 | /// Key handle for second EC private key value 69 | /// 70 | public uint PrivateData; 71 | 72 | /// 73 | /// The length in bytes of the other party's second EC public key 74 | /// 75 | public uint PublicDataLen2; 76 | 77 | /// 78 | /// Pointer to other party's second EC public key value 79 | /// 80 | public IntPtr PublicData2; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_ECMQV_DERIVE_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_ECMQV_DERIVE mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_ECMQV_DERIVE_PARAMS 36 | { 37 | /// 38 | /// Key derivation function used on the shared secret value (CKD) 39 | /// 40 | public uint Kdf; 41 | 42 | /// 43 | /// The length in bytes of the shared info 44 | /// 45 | public uint SharedDataLen; 46 | 47 | /// 48 | /// Some data shared between the two parties 49 | /// 50 | public IntPtr SharedData; 51 | 52 | /// 53 | /// The length in bytes of the other party's first EC public key 54 | /// 55 | public uint PublicDataLen; 56 | 57 | /// 58 | /// Pointer to other party's first EC public key value 59 | /// 60 | public IntPtr PublicData; 61 | 62 | /// 63 | /// The length in bytes of the second EC private key 64 | /// 65 | public uint PrivateDataLen; 66 | 67 | /// 68 | /// Key handle for second EC private key value 69 | /// 70 | public uint PrivateData; 71 | 72 | /// 73 | /// The length in bytes of the other party's second EC public key 74 | /// 75 | public uint PublicDataLen2; 76 | 77 | /// 78 | /// Pointer to other party's second EC public key value 79 | /// 80 | public IntPtr PublicData2; 81 | 82 | /// 83 | /// Handle to the first party's ephemeral public key 84 | /// 85 | public uint PublicKey; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_EXTRACT_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Provides the parameter to the CKM_EXTRACT_KEY_FROM_KEY mechanism 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_EXTRACT_PARAMS 35 | { 36 | /// 37 | /// Specifies which bit of the base key should be used as the first bit of the derived key 38 | /// 39 | public uint Bit; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_KEA_DERIVE_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_KEA_DERIVE mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_KEA_DERIVE_PARAMS 36 | { 37 | /// 38 | /// Option for generating the key (called a TEK). True if the sender (originator) generates the TEK, false if the recipient is regenerating the TEK. 39 | /// 40 | public bool IsSender; 41 | 42 | /// 43 | /// Size of random Ra and Rb, in bytes 44 | /// 45 | public uint RandomLen; 46 | 47 | /// 48 | /// Pointer to Ra data 49 | /// 50 | public IntPtr RandomA; 51 | 52 | /// 53 | /// Pointer to Rb data 54 | /// 55 | public IntPtr RandomB; 56 | 57 | /// 58 | /// Other party's KEA public key size 59 | /// 60 | public uint PublicDataLen; 61 | 62 | /// 63 | /// Pointer to other party's KEA public key value 64 | /// 65 | public IntPtr PublicData; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_KEY_DERIVATION_STRING_DATA.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Provides the parameters for the CKM_CONCATENATE_BASE_AND_DATA, CKM_CONCATENATE_DATA_AND_BASE and CKM_XOR_BASE_AND_DATA mechanisms 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_KEY_DERIVATION_STRING_DATA 36 | { 37 | /// 38 | /// Pointer to the byte string 39 | /// 40 | public IntPtr Data; 41 | 42 | /// 43 | /// Length of the byte string 44 | /// 45 | public uint Len; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_KEY_WRAP_SET_OAEP_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_KEY_WRAP_SET_OAEP mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_KEY_WRAP_SET_OAEP_PARAMS 36 | { 37 | /// 38 | /// Block contents byte 39 | /// 40 | public byte BC; 41 | 42 | /// 43 | /// Concatenation of hash of plaintext data (if present) and extra data (if present) 44 | /// 45 | public IntPtr X; 46 | 47 | /// 48 | /// Length in bytes of concatenation of hash of plaintext data (if present) and extra data (if present) or 0 if neither is present 49 | /// 50 | public uint XLen; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_KIP_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to CKM_KIP_DERIVE, CKM_KIP_WRAP and CKM_KIP_MAC mechanisms 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_KIP_PARAMS 36 | { 37 | /// 38 | /// Pointer to the underlying cryptographic mechanism (CKM) 39 | /// 40 | public IntPtr Mechanism; 41 | 42 | /// 43 | /// Handle to a key that will contribute to the entropy of the derived key (CKM_KIP_DERIVE) or will be used in the MAC operation (CKM_KIP_MAC) 44 | /// 45 | public uint Key; 46 | 47 | /// 48 | /// Pointer to an input seed 49 | /// 50 | public IntPtr Seed; 51 | 52 | /// 53 | /// Length in bytes of the input seed 54 | /// 55 | public uint SeedLen; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_MAC_GENERAL_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Structure that provides the parameters to the general-length MACing mechanisms (DES, DES3, CAST, CAST3, CAST128 (CAST5), IDEA, CDMF and AES), the general length HMACing mechanisms (MD2, MD5, SHA-1, SHA-256, SHA-384, SHA-512, RIPEMD-128 and RIPEMD-160) and the two SSL 3.0 MACing mechanisms (MD5 and SHA-1) 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_MAC_GENERAL_PARAMS 35 | { 36 | /// 37 | /// Length of the MAC produced, in bytes 38 | /// 39 | public uint MacLength; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_OTP_PARAM.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that includes the type, value and length of an OTP parameter 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_OTP_PARAM 36 | { 37 | /// 38 | /// Parameter type 39 | /// 40 | public uint Type; 41 | 42 | /// 43 | /// Pointer to the value of the parameter 44 | /// 45 | public IntPtr Value; 46 | 47 | /// 48 | /// Length in bytes of the value 49 | /// 50 | public uint ValueLen; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_OTP_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that is used to provide parameters for OTP mechanisms in a generic fashion 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_OTP_PARAMS 36 | { 37 | /// 38 | /// Pointer to an array of OTP parameters (CK_OTP_PARAM structures) 39 | /// 40 | public IntPtr Params; 41 | 42 | /// 43 | /// The number of parameters in the array 44 | /// 45 | public uint Count; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_OTP_SIGNATURE_INFO.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that is returned by all OTP mechanisms in successful calls to C_Sign (C_SignFinal) 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_OTP_SIGNATURE_INFO 36 | { 37 | /// 38 | /// Pointer to an array of OTP parameter values (CK_OTP_PARAM structures) 39 | /// 40 | public IntPtr Params; 41 | 42 | /// 43 | /// The number of parameters in the array 44 | /// 45 | public uint Count; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_PBE_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure which provides all of the necessary information required by the CKM_PBE mechanisms and the CKM_PBA_SHA1_WITH_SHA1_HMAC mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_PBE_PARAMS 36 | { 37 | /// 38 | /// Pointer to the location that receives the 8-byte initialization vector (IV), if an IV is required 39 | /// 40 | public IntPtr InitVector; 41 | 42 | /// 43 | /// Points to the password to be used in the PBE key generation 44 | /// 45 | public IntPtr Password; 46 | 47 | /// 48 | /// Length in bytes of the password information 49 | /// 50 | public uint PasswordLen; 51 | 52 | /// 53 | /// Points to the salt to be used in the PBE key generation 54 | /// 55 | public IntPtr Salt; 56 | 57 | /// 58 | /// Length in bytes of the salt information 59 | /// 60 | public uint SaltLen; 61 | 62 | /// 63 | /// Number of iterations required for the generation 64 | /// 65 | public uint Iteration; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_PKCS5_PBKD2_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_PKCS5_PBKD2 mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_PKCS5_PBKD2_PARAMS 36 | { 37 | /// 38 | /// Source of the salt value (CKZ) 39 | /// 40 | public uint SaltSource; 41 | 42 | /// 43 | /// Data used as the input for the salt source 44 | /// 45 | public IntPtr SaltSourceData; 46 | 47 | /// 48 | /// Length of the salt source input 49 | /// 50 | public uint SaltSourceDataLen; 51 | 52 | /// 53 | /// Number of iterations to perform when generating each block of random data 54 | /// 55 | public uint Iterations; 56 | 57 | /// 58 | /// Pseudo-random function to used to generate the key (CKP) 59 | /// 60 | public uint Prf; 61 | 62 | /// 63 | /// Data used as the input for PRF in addition to the salt value 64 | /// 65 | public IntPtr PrfData; 66 | 67 | /// 68 | /// Length of the input data for the PRF 69 | /// 70 | public uint PrfDataLen; 71 | 72 | /// 73 | /// Points to the password to be used in the PBE key generation 74 | /// 75 | public IntPtr Password; 76 | 77 | /// 78 | /// Length in bytes of the password information 79 | /// 80 | public uint PasswordLen; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_RC2_CBC_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Structure that provides the parameters to the CKM_RC2_CBC and CKM_RC2_CBC_PAD mechanisms 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_RC2_CBC_PARAMS 35 | { 36 | /// 37 | /// The effective number of bits in the RC2 search space 38 | /// 39 | public uint EffectiveBits; 40 | 41 | /// 42 | /// The initialization vector (IV) for cipher block chaining mode 43 | /// 44 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] 45 | public byte[] Iv; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_RC2_MAC_GENERAL_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Structure that provides the parameters to the CKM_RC2_MAC_GENERAL mechanism 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_RC2_MAC_GENERAL_PARAMS 35 | { 36 | /// 37 | /// The effective number of bits in the RC2 search space 38 | /// 39 | public uint EffectiveBits; 40 | 41 | /// 42 | /// Length of the MAC produced, in bytes 43 | /// 44 | public uint MacLength; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_RC2_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Provides the parameters to the CKM_RC2_ECB and CKM_RC2_MAC mechanisms 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_RC2_PARAMS 35 | { 36 | /// 37 | /// Effective number of bits in the RC2 search space 38 | /// 39 | public uint EffectiveBits; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_RC5_CBC_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_RC5_CBC and CKM_RC5_CBC_PAD mechanisms 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_RC5_CBC_PARAMS 36 | { 37 | /// 38 | /// Wordsize of RC5 cipher in bytes 39 | /// 40 | public uint Wordsize; 41 | 42 | /// 43 | /// Number of rounds of RC5 encipherment 44 | /// 45 | public uint Rounds; 46 | 47 | /// 48 | /// Pointer to initialization vector (IV) for CBC encryption 49 | /// 50 | public IntPtr Iv; 51 | 52 | /// 53 | /// Length of initialization vector (must be same as blocksize) 54 | /// 55 | public uint IvLen; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_RC5_MAC_GENERAL_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Structure that provides the parameters to the CKM_RC5_MAC_GENERAL mechanism 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_RC5_MAC_GENERAL_PARAMS 35 | { 36 | /// 37 | /// Wordsize of RC5 cipher in bytes 38 | /// 39 | public uint Wordsize; 40 | 41 | /// 42 | /// Number of rounds of RC5 encipherment 43 | /// 44 | public uint Rounds; 45 | 46 | /// 47 | /// Length of the MAC produced, in bytes 48 | /// 49 | public uint MacLength; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_RC5_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Structure that provides the parameters to the CKM_RC5_ECB and CKM_RC5_MAC mechanisms 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_RC5_PARAMS 35 | { 36 | /// 37 | /// Wordsize of RC5 cipher in bytes 38 | /// 39 | public uint Wordsize; 40 | 41 | /// 42 | /// Number of rounds of RC5 encipherment 43 | /// 44 | public uint Rounds; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_RSA_PKCS_OAEP_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_RSA_PKCS_OAEP mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_RSA_PKCS_OAEP_PARAMS 36 | { 37 | /// 38 | /// Mechanism ID of the message digest algorithm used to calculate the digest of the encoding parameter (CKM) 39 | /// 40 | public uint HashAlg; 41 | 42 | /// 43 | /// Mask generation function to use on the encoded block (CKG) 44 | /// 45 | public uint Mgf; 46 | 47 | /// 48 | /// Source of the encoding parameter (CKZ) 49 | /// 50 | public uint Source; 51 | 52 | /// 53 | /// Data used as the input for the encoding parameter source 54 | /// 55 | public IntPtr SourceData; 56 | 57 | /// 58 | /// Length of the encoding parameter source input 59 | /// 60 | public uint SourceDataLen; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_RSA_PKCS_PSS_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 29 | { 30 | /// 31 | /// Structure that provides the parameters to the CKM_RSA_PKCS_PSS mechanism 32 | /// 33 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 34 | public struct CK_RSA_PKCS_PSS_PARAMS 35 | { 36 | /// 37 | /// Hash algorithm used in the PSS encoding (CKM) 38 | /// 39 | public uint HashAlg; 40 | 41 | /// 42 | /// Mask generation function to use on the encoded block (CKG) 43 | /// 44 | public uint Mgf; 45 | 46 | /// 47 | /// Length, in bytes, of the salt value used in the PSS encoding 48 | /// 49 | public uint Len; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_SKIPJACK_PRIVATE_WRAP_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_SKIPJACK_PRIVATE_WRAP mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS 36 | { 37 | /// 38 | /// Length of the password 39 | /// 40 | public uint PasswordLen; 41 | 42 | /// 43 | /// Pointer to the buffer which contains the user-supplied password 44 | /// 45 | public IntPtr Password; 46 | 47 | /// 48 | /// Other party's key exchange public key size 49 | /// 50 | public uint PublicDataLen; 51 | 52 | /// 53 | /// Pointer to other party's key exchange public key value 54 | /// 55 | public IntPtr PublicData; 56 | 57 | /// 58 | /// Length of prime and base values 59 | /// 60 | public uint PAndGLen; 61 | 62 | /// 63 | /// Length of subprime value 64 | /// 65 | public uint QLen; 66 | 67 | /// 68 | /// Size of random Ra, in bytes 69 | /// 70 | public uint RandomLen; 71 | 72 | /// 73 | /// Pointer to Ra data 74 | /// 75 | public IntPtr RandomA; 76 | 77 | /// 78 | /// Pointer to Prime, p, value 79 | /// 80 | public IntPtr PrimeP; 81 | 82 | /// 83 | /// Pointer to Base, g, value 84 | /// 85 | public IntPtr BaseG; 86 | 87 | /// 88 | /// Pointer to Subprime, q, value 89 | /// 90 | public IntPtr SubprimeQ; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_SKIPJACK_RELAYX_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_SKIPJACK_RELAYX mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_SKIPJACK_RELAYX_PARAMS 36 | { 37 | /// 38 | /// Length of old wrapped key in bytes 39 | /// 40 | public uint OldWrappedXLen; 41 | 42 | /// 43 | /// Pointer to old wrapper key 44 | /// 45 | public IntPtr OldWrappedX; 46 | 47 | /// 48 | /// Length of the old password 49 | /// 50 | public uint OldPasswordLen; 51 | 52 | /// 53 | /// Pointer to the buffer which contains the old user-supplied password 54 | /// 55 | public IntPtr OldPassword; 56 | 57 | /// 58 | /// Old key exchange public key size 59 | /// 60 | public uint OldPublicDataLen; 61 | 62 | /// 63 | /// Pointer to old key exchange public key value 64 | /// 65 | public IntPtr OldPublicData; 66 | 67 | /// 68 | /// Size of old random Ra in bytes 69 | /// 70 | public uint OldRandomLen; 71 | 72 | /// 73 | /// Pointer to old Ra data 74 | /// 75 | public IntPtr OldRandomA; 76 | 77 | /// 78 | /// Length of the new password 79 | /// 80 | public uint NewPasswordLen; 81 | 82 | /// 83 | /// Pointer to the buffer which contains the new usersupplied password 84 | /// 85 | public IntPtr NewPassword; 86 | 87 | /// 88 | /// New key exchange public key size 89 | /// 90 | public uint NewPublicDataLen; 91 | 92 | /// 93 | /// Pointer to new key exchange public key value 94 | /// 95 | public IntPtr NewPublicData; 96 | 97 | /// 98 | /// Size of new random Ra in bytes 99 | /// 100 | public uint NewRandomLen; 101 | 102 | /// 103 | /// Pointer to new Ra data 104 | /// 105 | public IntPtr NewRandomA; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_SSL3_KEY_MAT_OUT.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that contains the resulting key handles and initialization vectors after performing a C_DeriveKey function with the CKM_SSL3_KEY_AND_MAC_DERIVE mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_SSL3_KEY_MAT_OUT 36 | { 37 | /// 38 | /// Key handle for the resulting Client MAC Secret key 39 | /// 40 | public uint ClientMacSecret; 41 | 42 | /// 43 | /// Key handle for the resulting Server MAC Secret key 44 | /// 45 | public uint ServerMacSecret; 46 | 47 | /// 48 | /// Key handle for the resulting Client Secret key 49 | /// 50 | public uint ClientKey; 51 | 52 | /// 53 | /// Key handle for the resulting Server Secret key 54 | /// 55 | public uint ServerKey; 56 | 57 | /// 58 | /// Pointer to a location which receives the initialization vector (IV) created for the client (if any) 59 | /// 60 | public IntPtr IVClient; 61 | 62 | /// 63 | /// Pointer to a location which receives the initialization vector (IV) created for the server (if any) 64 | /// 65 | public IntPtr IVServer; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_SSL3_KEY_MAT_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_SSL3_KEY_AND_MAC_DERIVE mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_SSL3_KEY_MAT_PARAMS 36 | { 37 | /// 38 | /// The length (in bits) of the MACing keys agreed upon during the protocol handshake phase 39 | /// 40 | public uint MacSizeInBits; 41 | 42 | /// 43 | /// The length (in bits) of the secret keys agreed upon during the protocol handshake phase 44 | /// 45 | public uint KeySizeInBits; 46 | 47 | /// 48 | /// The length (in bits) of the IV agreed upon during the protocol handshake phase or if no IV is required, the length should be set to 0 49 | /// 50 | public uint IVSizeInBits; 51 | 52 | /// 53 | /// Flag which indicates whether the keys have to be derived for an export version of the protocol 54 | /// 55 | public bool IsExport; 56 | 57 | /// 58 | /// Client's and server's random data information 59 | /// 60 | public CK_SSL3_RANDOM_DATA RandomInfo; 61 | 62 | /// 63 | /// Points to a CK_SSL3_KEY_MAT_OUT structure which receives the handles for the keys generated and the IVs 64 | /// 65 | public IntPtr ReturnedKeyMaterial; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_SSL3_MASTER_KEY_DERIVE_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_SSL3_MASTER_KEY_DERIVE and CKM_SSL3_MASTER_KEY_DERIVE_DH mechanisms 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS 36 | { 37 | /// 38 | /// Client's and server's random data information 39 | /// 40 | public CK_SSL3_RANDOM_DATA RandomInfo; 41 | 42 | /// 43 | /// Pointer to a CK_VERSION structure which receives the SSL protocol version information 44 | /// 45 | public IntPtr Version; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_SSL3_RANDOM_DATA.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure which provides information about the random data of a client and a server in an SSL context 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_SSL3_RANDOM_DATA 36 | { 37 | /// 38 | /// Pointer to the client's random data 39 | /// 40 | public IntPtr ClientRandom; 41 | 42 | /// 43 | /// Length in bytes of the client's random data 44 | /// 45 | public uint ClientRandomLen; 46 | 47 | /// 48 | /// Pointer to the server's random data 49 | /// 50 | public IntPtr ServerRandom; 51 | 52 | /// 53 | /// Length in bytes of the server's random data 54 | /// 55 | public uint ServerRandomLen; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_TLS_PRF_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure, which provides the parameters to the CKM_TLS_PRF mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_TLS_PRF_PARAMS 36 | { 37 | /// 38 | /// Pointer to the input seed 39 | /// 40 | public IntPtr Seed; 41 | 42 | /// 43 | /// Length in bytes of the input seed 44 | /// 45 | public uint SeedLen; 46 | 47 | /// 48 | /// Pointer to the identifying label 49 | /// 50 | public IntPtr Label; 51 | 52 | /// 53 | /// Length in bytes of the identifying label 54 | /// 55 | public uint LabelLen; 56 | 57 | /// 58 | /// Pointer receiving the output of the operation 59 | /// 60 | public IntPtr Output; 61 | 62 | /// 63 | /// Pointer to the length in bytes (uint) that the output to be created shall have, has to hold the desired length as input and will receive the calculated length as output 64 | /// 65 | public IntPtr OutputLen; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_WTLS_KEY_MAT_OUT.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that contains the resulting key handles and initialization vectors after performing a C_DeriveKey function with the CKM_WTLS_SEVER_KEY_AND_MAC_DERIVE or with the CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_WTLS_KEY_MAT_OUT 36 | { 37 | /// 38 | /// Key handle for the resulting MAC secret key 39 | /// 40 | public uint MacSecret; 41 | 42 | /// 43 | /// Key handle for the resulting secret key 44 | /// 45 | public uint Key; 46 | 47 | /// 48 | /// Pointer to a location which receives the initialization vector (IV) created (if any) 49 | /// 50 | public IntPtr IV; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_WTLS_KEY_MAT_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE and the CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE mechanisms 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_WTLS_KEY_MAT_PARAMS 36 | { 37 | /// 38 | /// The digest mechanism to be used (CKM) 39 | /// 40 | public uint DigestMechanism; 41 | 42 | /// 43 | /// The length (in bits) of the MACing key agreed upon during the protocol handshake phase 44 | /// 45 | public uint MacSizeInBits; 46 | 47 | /// 48 | /// The length (in bits) of the secret key agreed upon during the handshake phase 49 | /// 50 | public uint KeySizeInBits; 51 | 52 | /// 53 | /// The length (in bits) of the IV agreed upon during the handshake phase or if no IV is required, the length should be set to 0 54 | /// 55 | public uint IVSizeInBits; 56 | 57 | /// 58 | /// The current sequence number used for records sent by the client and server respectively 59 | /// 60 | public uint SequenceNumber; 61 | 62 | /// 63 | /// Flag which indicates whether the keys have to be derived for an export version of the protocol 64 | /// 65 | public bool IsExport; 66 | 67 | /// 68 | /// Client's and server's random data information 69 | /// 70 | public CK_WTLS_RANDOM_DATA RandomInfo; 71 | 72 | /// 73 | /// Points to a CK_WTLS_KEY_MAT_OUT structure which receives the handles for the keys generated and the IV 74 | /// 75 | public IntPtr ReturnedKeyMaterial; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_WTLS_MASTER_KEY_DERIVE_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure, which provides the parameters to the CKM_WTLS_MASTER_KEY_DERIVE mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_WTLS_MASTER_KEY_DERIVE_PARAMS 36 | { 37 | /// 38 | /// Digest mechanism to be used (CKM) 39 | /// 40 | public uint DigestMechanism; 41 | 42 | /// 43 | /// Client's and server's random data information 44 | /// 45 | public CK_WTLS_RANDOM_DATA RandomInfo; 46 | 47 | /// 48 | /// Pointer to single byte which receives the WTLS protocol version information 49 | /// 50 | public IntPtr Version; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_WTLS_PRF_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure, which provides the parameters to the CKM_WTLS_PRF mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_WTLS_PRF_PARAMS 36 | { 37 | /// 38 | /// Digest mechanism to be used (CKM) 39 | /// 40 | public uint DigestMechanism; 41 | 42 | /// 43 | /// Pointer to the input seed 44 | /// 45 | public IntPtr Seed; 46 | 47 | /// 48 | /// Length in bytes of the input seed 49 | /// 50 | public uint SeedLen; 51 | 52 | /// 53 | /// Pointer to the identifying label 54 | /// 55 | public IntPtr Label; 56 | 57 | /// 58 | /// Length in bytes of the identifying label 59 | /// 60 | public uint LabelLen; 61 | 62 | /// 63 | /// Pointer receiving the output of the operation 64 | /// 65 | public IntPtr Output; 66 | 67 | /// 68 | /// Pointer to the length in bytes (uint) that the output to be created shall have, has to hold the desired length as input and will receive the calculated length as output 69 | /// 70 | public IntPtr OutputLen; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_WTLS_RANDOM_DATA.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure, which provides information about the random data of a client and a server in a WTLS context 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_WTLS_RANDOM_DATA 36 | { 37 | /// 38 | /// Pointer to the client's random data 39 | /// 40 | public IntPtr ClientRandom; 41 | 42 | /// 43 | /// Length in bytes of the client's random data 44 | /// 45 | public uint ClientRandomLen; 46 | 47 | /// 48 | /// Pointer to the server's random data 49 | /// 50 | public IntPtr ServerRandom; 51 | 52 | /// 53 | /// Length in bytes of the server's random data 54 | /// 55 | public uint ServerRandomLen; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_X9_42_DH1_DERIVE_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_X9_42_DH_DERIVE key derivation mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_X9_42_DH1_DERIVE_PARAMS 36 | { 37 | /// 38 | /// Key derivation function used on the shared secret value (CKD) 39 | /// 40 | public uint Kdf; 41 | 42 | /// 43 | /// The length in bytes of the other info 44 | /// 45 | public uint OtherInfoLen; 46 | 47 | /// 48 | /// Some data shared between the two parties 49 | /// 50 | public IntPtr OtherInfo; 51 | 52 | /// 53 | /// The length in bytes of the other party's X9.42 Diffie-Hellman public key 54 | /// 55 | public uint PublicDataLen; 56 | 57 | /// 58 | /// Pointer to other party's X9.42 Diffie-Hellman public key value 59 | /// 60 | public IntPtr PublicData; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_X9_42_DH2_DERIVE_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation mechanisms 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_X9_42_DH2_DERIVE_PARAMS 36 | { 37 | /// 38 | /// Key derivation function used on the shared secret value (CKD) 39 | /// 40 | public uint Kdf; 41 | 42 | /// 43 | /// The length in bytes of the other info 44 | /// 45 | public uint OtherInfoLen; 46 | 47 | /// 48 | /// Some data shared between the two parties 49 | /// 50 | public IntPtr OtherInfo; 51 | 52 | /// 53 | /// The length in bytes of the other party's first X9.42 Diffie-Hellman public key 54 | /// 55 | public uint PublicDataLen; 56 | 57 | /// 58 | /// Pointer to other party's first X9.42 Diffie-Hellman public key value 59 | /// 60 | public IntPtr PublicData; 61 | 62 | /// 63 | /// The length in bytes of the second X9.42 Diffie-Hellman private key 64 | /// 65 | public uint PrivateDataLen; 66 | 67 | /// 68 | /// Key handle for second X9.42 Diffie-Hellman private key value 69 | /// 70 | public uint PrivateData; 71 | 72 | /// 73 | /// The length in bytes of the other party's second X9.42 Diffie-Hellman public key 74 | /// 75 | public uint PublicDataLen2; 76 | 77 | /// 78 | /// Pointer to other party's second X9.42 Diffie-Hellman public key value 79 | /// 80 | public IntPtr PublicData2; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Pkcs11Interop/LowLevelAPI/MechanismParams/CK_X9_42_MQV_DERIVE_PARAMS.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Pkcs11Interop - Open-source .NET wrapper for unmanaged PKCS#11 libraries 3 | * Copyright (c) 2012-2013 JWC s.r.o. 4 | * Author: Jaroslav Imrich 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License version 3 8 | * as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can be released from the requirements of the license by purchasing 19 | * a commercial license. Buying such a license is mandatory as soon as you 20 | * develop commercial activities involving the Pkcs11Interop software without 21 | * disclosing the source code of your own applications. 22 | * 23 | * For more information, please contact JWC s.r.o. at info@pkcs11interop.net 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | 29 | namespace Net.Pkcs11Interop.LowLevelAPI.MechanismParams 30 | { 31 | /// 32 | /// Structure that provides the parameters to the CKM_X9_42_MQV_DERIVE key derivation mechanism 33 | /// 34 | [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] 35 | public struct CK_X9_42_MQV_DERIVE_PARAMS 36 | { 37 | /// 38 | /// Key derivation function used on the shared secret value (CKD) 39 | /// 40 | public uint Kdf; 41 | 42 | /// 43 | /// The length in bytes of the other info 44 | /// 45 | public uint OtherInfoLen; 46 | 47 | /// 48 | /// Some data shared between the two parties 49 | /// 50 | public IntPtr OtherInfo; 51 | 52 | /// 53 | /// The length in bytes of the other party's first X9.42 Diffie-Hellman public key 54 | /// 55 | public uint PublicDataLen; 56 | 57 | /// 58 | /// Pointer to other party's first X9.42 Diffie-Hellman public key value 59 | /// 60 | public IntPtr PublicData; 61 | 62 | /// 63 | /// The length in bytes of the second X9.42 Diffie-Hellman private key 64 | /// 65 | public uint PrivateDataLen; 66 | 67 | /// 68 | /// Key handle for second X9.42 Diffie-Hellman private key value 69 | /// 70 | public uint PrivateData; 71 | 72 | /// 73 | /// The length in bytes of the other party's second X9.42 Diffie-Hellman public key 74 | /// 75 | public uint PublicDataLen2; 76 | 77 | /// 78 | /// Pointer to other party's second X9.42 Diffie-Hellman public key value 79 | /// 80 | public IntPtr PublicData2; 81 | 82 | /// 83 | /// Handle to the first party's ephemeral public key 84 | /// 85 | public uint PublicKey; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Pkcs11Interop/Pkcs11Interop.pidb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nitrokey/nitrokey-keepass-plugin/336249d6ffb439e11346356d1c89b14dd9266f08/Pkcs11Interop/Pkcs11Interop.pidb -------------------------------------------------------------------------------- /Pkcs11Interop/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Pkcs11Interop/bin/Debug/Pkcs11Interop.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nitrokey/nitrokey-keepass-plugin/336249d6ffb439e11346356d1c89b14dd9266f08/Pkcs11Interop/bin/Debug/Pkcs11Interop.dll -------------------------------------------------------------------------------- /Pkcs11Interop/bin/Debug/Pkcs11Interop.dll.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Pkcs11Interop/bin/Debug/Pkcs11Interop.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nitrokey/nitrokey-keepass-plugin/336249d6ffb439e11346356d1c89b14dd9266f08/Pkcs11Interop/bin/Debug/Pkcs11Interop.dll.mdb -------------------------------------------------------------------------------- /Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("CryptokiKeyProvider")] 6 | [assembly: AssemblyDescription("PKCS#11 support for keepass")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("Daniel Pieper")] 9 | [assembly: AssemblyProduct("KeePass Plugin")] 10 | [assembly: AssemblyCopyright("Copyright © Daniel Pieper 2013")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: Guid("073eb815-dd5c-4ebf-be73-6fadb0d8f724")] 15 | [assembly: AssemblyVersion("0.1.1.0")] 16 | [assembly: AssemblyFileVersion("0.1.1.0")] 17 | -------------------------------------------------------------------------------- /Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Dieser Code wurde von einem Tool generiert. 4 | // Laufzeitversion:4.0.30319.17929 5 | // 6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn 7 | // der Code erneut generiert wird. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CryptokiKeyProvider.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Nitrokey Keepass Plugin 3 | 4 | This is an abandoned project, which contains implementation of the PKCS#11 support for the [Keepass2] v2.22. While it might not work currently, it could be used as a starting point for the development in other projects. 5 | 6 | For end-user, instead of this one, please use other plugin for protecting the password database - [OtpKeyProv]. See this [comment] for details, which links to this [guide]. 7 | 8 | [comment]: https://github.com/Nitrokey/nitrokey-keepass-plugin/issues/2#issuecomment-293904422 9 | [guide]: https://www.nitrokey.com/documentation/applications#a:password-manager 10 | [OtpKeyProv]: https://keepass.info/plugins.html#otpkeyprov 11 | 12 | 13 | |Warning| 14 | |---| 15 | |This repository provides Keepass2 binary in version v2.22. Please keep in mind, that current version is v2.41. See official [Keepass2] page for details.| 16 | 17 | [Keepass2]: https://keepass.info/ 18 | 19 | ## Current state 20 | Whether plugin currently works is not confirmed - to test on Windows. 21 | 22 | On Fedora Linux 29 the provided Keepass binary successfully launches (via Mono), and finds the plugin. The latter expects a `Pkcs11Interop` library in a `.so` format, while official package distributes only `.dll`, so further tests are not possible on this OS. 23 | 24 | Provided Keepass binary does not work correctly, when launched with Wine 4.0. 25 | 26 | 27 | ## License 28 | Project is licensed under GPLv3. It contains an old version of Pkcs11Interop, and this particular one is licensed under AGPL - see [Pkcs11Interop] directory for the details, and [official Pkcs11Interop site]. 29 | 30 | [Pkcs11Interop]: ./Pkcs11Interop/ 31 | [official Pkcs11Interop site]: https://www.pkcs11interop.net/ -------------------------------------------------------------------------------- /Resource.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Dieser Code wurde von einem Tool generiert. 4 | // Laufzeitversion:4.0.30319.17929 5 | // 6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn 7 | // der Code erneut generiert wird. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CryptokiKeyProvider { 12 | using System; 13 | 14 | 15 | /// 16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. 17 | /// 18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert 19 | // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. 20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen 21 | // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resource { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resource() { 33 | } 34 | 35 | /// 36 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CryptokiKeyProvider.Resource", typeof(Resource).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle 51 | /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap chip { 67 | get { 68 | object obj = ResourceManager.GetObject("chip", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Resource.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nitrokey/nitrokey-keepass-plugin/336249d6ffb439e11346356d1c89b14dd9266f08/Resource.resources -------------------------------------------------------------------------------- /Resources/chip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nitrokey/nitrokey-keepass-plugin/336249d6ffb439e11346356d1c89b14dd9266f08/Resources/chip.png -------------------------------------------------------------------------------- /bin/Debug/CryptokiKeyProvider.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nitrokey/nitrokey-keepass-plugin/336249d6ffb439e11346356d1c89b14dd9266f08/bin/Debug/CryptokiKeyProvider.dll -------------------------------------------------------------------------------- /bin/Debug/CryptokiKeyProvider.dll.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /bin/Debug/CryptokiKeyProvider.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nitrokey/nitrokey-keepass-plugin/336249d6ffb439e11346356d1c89b14dd9266f08/bin/Debug/CryptokiKeyProvider.dll.mdb -------------------------------------------------------------------------------- /bin/Debug/KeePass.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nitrokey/nitrokey-keepass-plugin/336249d6ffb439e11346356d1c89b14dd9266f08/bin/Debug/KeePass.exe -------------------------------------------------------------------------------- /bin/Debug/KeePass.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /bin/Debug/Pkcs11Interop.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nitrokey/nitrokey-keepass-plugin/336249d6ffb439e11346356d1c89b14dd9266f08/bin/Debug/Pkcs11Interop.dll -------------------------------------------------------------------------------- /bin/Debug/Pkcs11Interop.dll.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /bin/Debug/Pkcs11Interop.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nitrokey/nitrokey-keepass-plugin/336249d6ffb439e11346356d1c89b14dd9266f08/bin/Debug/Pkcs11Interop.dll.mdb --------------------------------------------------------------------------------