Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalratnam6 committed Nov 23, 2024
1 parent fffc685 commit 8451105
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public void init(String yamcsInstance, YConfiguration config) {
public byte[] encrypt(byte[] plainMessage)
throws NoSuchAlgorithmException,InvalidKeySpecException, InvalidKeyException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException {
byte[] iv = getRandomNonce(IV_LENGTH);

SecretKey secretKey = getSecretKey(keyMgmService.getTcKey());
log.warn("KeyBeing Used: {}", secretKey.toString());

Cipher cipher = initCipher(Cipher.ENCRYPT_MODE, secretKey, iv);
if (aad != null)
Expand Down Expand Up @@ -80,7 +80,7 @@ public SecretKey getSecretKey(String key)
public byte[] decrypt(byte[] cipherContent) throws NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException,
InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException {
SecretKey secretKey = getSecretKey(keyMgmService.getTmKey());

log.warn("KeyBeing Used: {}", secretKey.toString());
ByteBuffer bb = ByteBuffer.wrap(cipherContent);

byte[] iv = new byte[IV_LENGTH];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,12 @@ public String getPayloadKeyId(){

public void setTcKeyId(String tcKeyId) {
this.tcKeyId = tcKeyId;
this.tcKey = this.parser.getKeySections().get("TC Keys").get(config.getString("spacecraftIdSrs")+"_TC_"+tcKeyId).getKey();
}

public void setTmKeyId(String tmKeyId) {
this.tmKeyId = tmKeyId;
this.tmKey = this.parser.getKeySections().get("TM Keys").get(config.getString("spacecraftIdSrs")+"_TM_"+tmKeyId).getKey();
}

public void setPayloadKeyId(String payloadKeyId){
Expand Down

0 comments on commit 8451105

Please sign in to comment.