Class AzureKeyVault

java.lang.Object
org.codelibs.saml2.core.model.hsm.HSM
org.codelibs.saml2.core.model.hsm.AzureKeyVault

public class AzureKeyVault extends HSM
  • Constructor Summary

    Constructors
    Constructor
    Description
    AzureKeyVault(String clientId, String clientCredentials, String tenantId, String keyVaultId)
    Constructor to initialise an HSM object.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    decrypt(String algorithm, byte[] cipherText)
    Decrypts an array of bytes with a particular algorithm using the Azure Key Vault.
    byte[]
    encrypt(String algorithm, byte[] plainText)
    Encrypts an array of bytes with a particular algorithm using the Azure Key Vault.
    void
    Sets the client to connect to the Azure Key Vault.
    byte[]
    unwrapKey(String algorithmUrl, byte[] wrappedKey)
    Unwraps a key with a particular algorithm using the Azure Key Vault.
    byte[]
    wrapKey(String algorithm, byte[] key)
    Wraps a key with a particular algorithm using the Azure Key Vault.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AzureKeyVault

      public AzureKeyVault(String clientId, String clientCredentials, String tenantId, String keyVaultId)
      Constructor to initialise an HSM object.
      Parameters:
      clientId - The Azure Key Vault client ID.
      clientCredentials - The Azure Key Vault client credentials.
      tenantId - The Azure Key Vault tenant ID.
      keyVaultId - The Azure Key Vault ID.
  • Method Details

    • setClient

      public void setClient()
      Sets the client to connect to the Azure Key Vault.
      Specified by:
      setClient in class HSM
    • wrapKey

      public byte[] wrapKey(String algorithm, byte[] key)
      Wraps a key with a particular algorithm using the Azure Key Vault.
      Specified by:
      wrapKey in class HSM
      Parameters:
      algorithm - The algorithm to use to wrap the key.
      key - The key to wrap
      Returns:
      A wrapped key.
    • unwrapKey

      public byte[] unwrapKey(String algorithmUrl, byte[] wrappedKey)
      Unwraps a key with a particular algorithm using the Azure Key Vault.
      Specified by:
      unwrapKey in class HSM
      Parameters:
      algorithmUrl - The algorithm to use to unwrap the key.
      wrappedKey - The key to unwrap
      Returns:
      An unwrapped key.
    • encrypt

      public byte[] encrypt(String algorithm, byte[] plainText)
      Encrypts an array of bytes with a particular algorithm using the Azure Key Vault.
      Specified by:
      encrypt in class HSM
      Parameters:
      algorithm - The algorithm to use for encryption.
      plainText - The array of bytes to encrypt.
      Returns:
      An encrypted array of bytes.
    • decrypt

      public byte[] decrypt(String algorithm, byte[] cipherText)
      Decrypts an array of bytes with a particular algorithm using the Azure Key Vault.
      Specified by:
      decrypt in class HSM
      Parameters:
      algorithm - The algorithm to use for decryption.
      cipherText - The encrypted array of bytes.
      Returns:
      A decrypted array of bytes.