001package com.box.sdk;
002
003/** Contains the encryption preferences for JWT assertion. */
004public class JWTEncryptionPreferences {
005  private String publicKeyID;
006  private String privateKey;
007  private String privateKeyPassword;
008  private EncryptionAlgorithm encryptionAlgorithm;
009  private IPrivateKeyDecryptor privateKeyDecryptor = new BCPrivateKeyDecryptor();
010
011  /**
012   * Returns the ID for public key for validating the JWT signature.
013   *
014   * @return the publicKeyID.
015   */
016  public String getPublicKeyID() {
017    return this.publicKeyID;
018  }
019
020  /**
021   * Sets the ID for public key for validating the JWT signature.
022   *
023   * @param publicKeyID the publicKeyID to set.
024   */
025  public void setPublicKeyID(String publicKeyID) {
026    this.publicKeyID = publicKeyID;
027  }
028
029  /**
030   * Returns the private key for generating the JWT signature.
031   *
032   * @return the privateKey.
033   */
034  public String getPrivateKey() {
035    return this.privateKey;
036  }
037
038  /**
039   * Sets the private key for generating the JWT signature.
040   *
041   * @param privateKey the privateKey to set.
042   */
043  public void setPrivateKey(String privateKey) {
044    this.privateKey = privateKey;
045  }
046
047  /**
048   * Returns the password for the private key.
049   *
050   * @return the privateKeyPassword.
051   */
052  public String getPrivateKeyPassword() {
053    return this.privateKeyPassword;
054  }
055
056  /**
057   * Sets the password for the private key.
058   *
059   * @param privateKeyPassword the privateKeyPassword to set.
060   */
061  public void setPrivateKeyPassword(String privateKeyPassword) {
062    this.privateKeyPassword = privateKeyPassword;
063  }
064
065  /**
066   * Returns the type of encryption algorithm for JWT.
067   *
068   * @return the encryptionAlgorithm.
069   */
070  public EncryptionAlgorithm getEncryptionAlgorithm() {
071    return this.encryptionAlgorithm;
072  }
073
074  /**
075   * Sets the type of encryption algorithm for JWT.
076   *
077   * @param encryptionAlgorithm the encryptionAlgorithm to set.
078   */
079  public void setEncryptionAlgorithm(EncryptionAlgorithm encryptionAlgorithm) {
080    this.encryptionAlgorithm = encryptionAlgorithm;
081  }
082
083  /**
084   * Gets a decryptor used for decrypting the private key.
085   *
086   * @return the decryptor used for decrypting the private key.
087   */
088  public IPrivateKeyDecryptor getPrivateKeyDecryptor() {
089    return privateKeyDecryptor;
090  }
091
092  /**
093   * Sets a custom decryptor used for decrypting the private key.
094   *
095   * @param privateKeyDecryptor the decryptor used for decrypting the private key.
096   */
097  public void setPrivateKeyDecryptor(IPrivateKeyDecryptor privateKeyDecryptor) {
098    this.privateKeyDecryptor = privateKeyDecryptor;
099  }
100}