Fix APG legacy encryption
Merge pull request #466 from thi/fix-apg-legacy-encryption

Fix APG legacy encryption