Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
nd1012 committed Feb 17, 2024
1 parent 0fc7175 commit 9f05757
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/wan24-Crypto-BC Tests/wan24-Crypto-BC Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="wan24-Crypto-Shared-Tests" Version="2.1.2" />
<PackageReference Include="wan24-Crypto-Shared-Tests" Version="2.1.3" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/wan24-Crypto-BC/AsymmetricXEd25519PrivateKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public override AsymmetricXEd25519PublicKey PublicKey
{
EnsureUndisposed();
if (Keys is null) throw new InvalidOperationException();
return _PublicKey ??= Activator.CreateInstance(typeof(AsymmetricXEd25519PublicKey), Keys.Public, GetX25519Key().PublicKey) as AsymmetricXEd25519PublicKey
?? throw new InvalidProgramException($"Failed to instance {typeof(AsymmetricXEd25519PublicKey)}");
return _PublicKey ??= new((Keys.Public as Ed25519PublicKeyParameters)!, GetX25519Key().PublicKey);
}
catch (CryptographicException)
{
Expand Down Expand Up @@ -136,6 +135,7 @@ protected override async Task DisposeCore()
private AsymmetricX25519PrivateKey GetX25519Key()
{
EnsureUndisposed();
if (X25519Key is not null) return X25519Key;
if (Keys?.Private is not Ed25519PrivateKeyParameters privateKey) throw new InvalidOperationException();
X25519PrivateKeyParameters pk = privateKey.ToX25519PrivateKey();
return X25519Key = new(new AsymmetricCipherKeyPair(pk.GeneratePublicKey(), pk));
Expand Down
4 changes: 2 additions & 2 deletions src/wan24-Crypto-BC/AsymmetricXEd448PrivateKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public override AsymmetricXEd448PublicKey PublicKey
{
EnsureUndisposed();
if (Keys is null) throw new InvalidOperationException();
return _PublicKey ??= Activator.CreateInstance(typeof(AsymmetricXEd448PublicKey), Keys.Public, GetX448Key().PublicKey) as AsymmetricXEd448PublicKey
?? throw new InvalidProgramException($"Failed to instance {typeof(AsymmetricXEd448PublicKey)}");
return _PublicKey ??= new((Keys.Public as Ed448PublicKeyParameters)!, GetX448Key().PublicKey);
}
catch (CryptographicException)
{
Expand Down Expand Up @@ -145,6 +144,7 @@ protected override async Task DisposeCore()
private AsymmetricX448PrivateKey GetX448Key()
{
EnsureUndisposed();
if (X448Key is not null) return X448Key;
if (Keys?.Private is not Ed448PrivateKeyParameters privateKey) throw new InvalidOperationException();
X448PrivateKeyParameters pk = privateKey.ToX448PrivateKey();
return X448Key = new(new AsymmetricCipherKeyPair(pk.GeneratePublicKey(), pk));
Expand Down
4 changes: 2 additions & 2 deletions src/wan24-Crypto-BC/wan24-Crypto-BC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

<ItemGroup>
<PackageReference Include="BouncyCastle.Cryptography" Version="2.3.0" />
<PackageReference Include="wan24-Core" Version="2.2.0" Condition="'$(Configuration)' != 'Trunk'" />
<PackageReference Include="wan24-Crypto" Version="2.2.0" Condition="'$(Configuration)' != 'Trunk'" />
<PackageReference Include="wan24-Core" Version="2.3.2" Condition="'$(Configuration)' != 'Trunk'" />
<PackageReference Include="wan24-Crypto" Version="2.4.0" Condition="'$(Configuration)' != 'Trunk'" />
<ProjectReference Include="..\..\..\wan24-Core\src\Wan24-Core\Wan24-Core.csproj" Condition="'$(Configuration)' == 'Trunk'" />
<ProjectReference Include="..\..\..\wan24-Crypto\src\wan24-Crypto\wan24-Crypto.csproj" Condition="'$(Configuration)' == 'Trunk'" />
</ItemGroup>
Expand Down

0 comments on commit 9f05757

Please sign in to comment.