Skip to content

Commit

Permalink
Added new session key creators for AES with GCM padding; #289
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Nov 30, 2024
1 parent bb5b32b commit 90485ce
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ public interface ICryptoSessionKeyProvider
}
};

ICryptoSessionKeyProvider INSTANCE_RANDOM_AES_128_GCM = () -> {
try
{
final KeyGenerator aKeyGen = KeyUtils.getKeyGenerator (WSS4JConstants.AES_128_GCM);
return aKeyGen.generateKey ();
}
catch (final WSSecurityException ex)
{
throw new IllegalStateException ("Failed to create session key (AES-128-GCM)", ex);
}
};

ICryptoSessionKeyProvider INSTANCE_RANDOM_AES_256 = () -> {
try
{
Expand All @@ -58,4 +70,16 @@ public interface ICryptoSessionKeyProvider
throw new IllegalStateException ("Failed to create session key (AES-256)", ex);
}
};

ICryptoSessionKeyProvider INSTANCE_RANDOM_AES_256_GCM = () -> {
try
{
final KeyGenerator aKeyGen = KeyUtils.getKeyGenerator (WSS4JConstants.AES_256_GCM);
return aKeyGen.generateKey ();
}
catch (final WSSecurityException ex)
{
throw new IllegalStateException ("Failed to create session key (AES-256-GCM)", ex);
}
};
}

0 comments on commit 90485ce

Please sign in to comment.