Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace bools in public API with enums #54

Merged
merged 9 commits into from
Jun 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\AppType.cs">
<Link>Common\AppType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\AttributeValueException.cs">
<Link>Common\AttributeValueException.cs</Link>
</Compile>
Expand Down Expand Up @@ -101,6 +104,9 @@
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\IMechanismParams.cs">
<Link>Common\IMechanismParams.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\InitType.cs">
<Link>Common\InitType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\LibraryArchitectureException.cs">
<Link>Common\LibraryArchitectureException.cs</Link>
</Compile>
Expand Down Expand Up @@ -128,6 +134,12 @@
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\Platform.cs">
<Link>Common\Platform.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\SessionType.cs">
<Link>Common\SessionType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\SlotsType.cs">
<Link>Common\SlotsType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\UnmanagedException.cs">
<Link>Common\UnmanagedException.cs</Link>
</Compile>
Expand All @@ -140,6 +152,9 @@
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\UnsupportedPlatformException.cs">
<Link>Common\UnsupportedPlatformException.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\WaitType.cs">
<Link>Common\WaitType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Doxygen.cs">
<Link>Doxygen.cs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\AppType.cs">
<Link>Common\AppType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\AttributeValueException.cs">
<Link>Common\AttributeValueException.cs</Link>
</Compile>
Expand Down Expand Up @@ -95,6 +98,9 @@
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\IMechanismParams.cs">
<Link>Common\IMechanismParams.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\InitType.cs">
<Link>Common\InitType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\LibraryArchitectureException.cs">
<Link>Common\LibraryArchitectureException.cs</Link>
</Compile>
Expand Down Expand Up @@ -122,6 +128,12 @@
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\Platform.cs">
<Link>Common\Platform.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\SessionType.cs">
<Link>Common\SessionType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\SlotsType.cs">
<Link>Common\SlotsType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\UnmanagedException.cs">
<Link>Common\UnmanagedException.cs</Link>
</Compile>
Expand All @@ -134,6 +146,9 @@
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\UnsupportedPlatformException.cs">
<Link>Common\UnsupportedPlatformException.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\WaitType.cs">
<Link>Common\WaitType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Doxygen.cs">
<Link>Doxygen.cs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
<Reference Include="System.Windows" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\AppType.cs">
<Link>Common\AppType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\AttributeValueException.cs">
<Link>Common\AttributeValueException.cs</Link>
</Compile>
Expand Down Expand Up @@ -119,6 +122,9 @@
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\IMechanismParams.cs">
<Link>Common\IMechanismParams.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\InitType.cs">
<Link>Common\InitType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\LibraryArchitectureException.cs">
<Link>Common\LibraryArchitectureException.cs</Link>
</Compile>
Expand Down Expand Up @@ -146,6 +152,12 @@
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\Platform.cs">
<Link>Common\Platform.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\SessionType.cs">
<Link>Common\SessionType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\SlotsType.cs">
<Link>Common\SlotsType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\UnmanagedException.cs">
<Link>Common\UnmanagedException.cs</Link>
</Compile>
Expand All @@ -158,6 +170,9 @@
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\UnsupportedPlatformException.cs">
<Link>Common\UnsupportedPlatformException.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\WaitType.cs">
<Link>Common\WaitType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Doxygen.cs">
<Link>Doxygen.cs</Link>
</Compile>
Expand Down
15 changes: 15 additions & 0 deletions src/Pkcs11Interop.iOS/Pkcs11Interop.iOS/Pkcs11Interop.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\AppType.cs">
<Link>Common\AppType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\AttributeValueException.cs">
<Link>Common\AttributeValueException.cs</Link>
</Compile>
Expand Down Expand Up @@ -98,6 +101,9 @@
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\IMechanismParams.cs">
<Link>Common\IMechanismParams.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\InitType.cs">
<Link>Common\InitType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\LibraryArchitectureException.cs">
<Link>Common\LibraryArchitectureException.cs</Link>
</Compile>
Expand Down Expand Up @@ -125,6 +131,12 @@
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\Platform.cs">
<Link>Common\Platform.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\SessionType.cs">
<Link>Common\SessionType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\SlotsType.cs">
<Link>Common\SlotsType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\UnmanagedException.cs">
<Link>Common\UnmanagedException.cs</Link>
</Compile>
Expand All @@ -137,6 +149,9 @@
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\UnsupportedPlatformException.cs">
<Link>Common\UnsupportedPlatformException.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Common\WaitType.cs">
<Link>Common\WaitType.cs</Link>
</Compile>
<Compile Include="..\..\Pkcs11Interop\Pkcs11Interop\Doxygen.cs">
<Link>Doxygen.cs</Link>
</Compile>
Expand Down
39 changes: 39 additions & 0 deletions src/Pkcs11Interop/Pkcs11Interop/Common/AppType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2012-2017 The Pkcs11Interop Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* Written for the Pkcs11Interop project by:
* Jaroslav IMRICH <[email protected]>
*/

namespace Net.Pkcs11Interop.Common
{
/// <summary>
/// Type of application that will be using PKCS#11 library
/// </summary>
public enum AppType
{
/// <summary>
/// Recommended option: PKCS#11 library will be used from multi-threaded application and needs to perform locking with native OS threading model (CKF_OS_LOCKING_OK)
/// </summary>
MultiThreaded,

/// <summary>
/// PKCS#11 library will be used from single-threaded application and does not need to perform any kind of locking
/// </summary>
SingleThreaded
}
}
39 changes: 39 additions & 0 deletions src/Pkcs11Interop/Pkcs11Interop/Common/InitType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2012-2017 The Pkcs11Interop Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* Written for the Pkcs11Interop project by:
* Jaroslav IMRICH <[email protected]>
*/

namespace Net.Pkcs11Interop.Common
{
/// <summary>
/// Source of PKCS#11 function pointers
/// </summary>
public enum InitType
{
/// <summary>
/// Recommended option: PKCS#11 function pointers will be acquired with single call of C_GetFunctionList function
/// </summary>
WithFunctionList,

/// <summary>
/// PKCS#11 function pointers will be acquired with multiple calls of GetProcAddress or dlsym function
/// </summary>
WithoutFunctionList
}
}
39 changes: 39 additions & 0 deletions src/Pkcs11Interop/Pkcs11Interop/Common/SessionType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2012-2017 The Pkcs11Interop Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* Written for the Pkcs11Interop project by:
* Jaroslav IMRICH <[email protected]>
*/

namespace Net.Pkcs11Interop.Common
{
/// <summary>
/// Type of session
/// </summary>
public enum SessionType
{
/// <summary>
/// Read-only session
/// </summary>
ReadOnly,

/// <summary>
/// Read-write session
/// </summary>
ReadWrite
}
}
39 changes: 39 additions & 0 deletions src/Pkcs11Interop/Pkcs11Interop/Common/SlotsType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2012-2017 The Pkcs11Interop Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* Written for the Pkcs11Interop project by:
* Jaroslav IMRICH <[email protected]>
*/

namespace Net.Pkcs11Interop.Common
{
/// <summary>
/// Type of slots to be obtained by PKCS#11 library
/// </summary>
public enum SlotsType
{
/// <summary>
/// Only slots with a token present
/// </summary>
WithTokenPresent,

/// <summary>
/// All slots regardless of token presence
/// </summary>
WithOrWithoutTokenPresent
}
}
39 changes: 39 additions & 0 deletions src/Pkcs11Interop/Pkcs11Interop/Common/WaitType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2012-2017 The Pkcs11Interop Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* Written for the Pkcs11Interop project by:
* Jaroslav IMRICH <[email protected]>
*/

namespace Net.Pkcs11Interop.Common
{
/// <summary>
/// Type of waiting for a slot event
/// </summary>
public enum WaitType
{
/// <summary>
/// Method should block until an event occurs
/// </summary>
Blocking,

/// <summary>
/// Method should not block until an event occurs
/// </summary>
NonBlocking
}
}
Loading