Skip to content

Commit

Permalink
ca-authority-key-export: use random IV
Browse files Browse the repository at this point in the history
  • Loading branch information
frasertweedale committed Aug 7, 2019
1 parent a47581f commit 477c4f0
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,16 @@ public void execute(String[] args) throws Exception {
WrappingParams params = null;

if (algOid.equals(DES_EDE3_CBC_OID)) {
byte iv[] = { 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1 };
EncryptionAlgorithm encAlg = EncryptionAlgorithm.DES3_CBC_PAD;
byte iv[] = CryptoUtil.getNonceData(encAlg.getIVLength());
IVParameterSpec ivps = new IVParameterSpec(iv);

params = new WrappingParams(
SymmetricKey.DES3, KeyGenAlgorithm.DES3, 168,
KeyWrapAlgorithm.RSA, EncryptionAlgorithm.DES3_CBC_PAD,
KeyWrapAlgorithm.RSA, encAlg,
KeyWrapAlgorithm.DES3_CBC_PAD, ivps, ivps);

aid = new AlgorithmIdentifier(algOid, new OCTET_STRING(ivps.getIV()));
aid = new AlgorithmIdentifier(algOid, new OCTET_STRING(iv));
}

else {
Expand Down

0 comments on commit 477c4f0

Please sign in to comment.