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