From: <ed...@bo...> - 2003-08-23 01:41:12
|
edwin 03/08/22 21:41:02 Modified: openpgp/src/cryptix/openpgp/algorithm PGPElGamal.java PGPRSA.java Log: More helpful error messages in case we get bitten by the Jurisdiction Policy Files. Revision Changes Path 1.27 +14 -1 projects/openpgp/src/cryptix/openpgp/algorithm/PGPElGamal.java Index: PGPElGamal.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/openpgp/src/cryptix/openpgp/algorithm/PGPElGamal.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- PGPElGamal.java 31 Jan 2003 00:52:24 -0000 1.26 +++ PGPElGamal.java 23 Aug 2003 01:41:02 -0000 1.27 @@ -1,4 +1,4 @@ -/* $Id: PGPElGamal.java,v 1.26 2003/01/31 00:52:24 edwin Exp $ +/* $Id: PGPElGamal.java,v 1.27 2003/08/23 01:41:02 edwin Exp $ * * Copyright (C) 1999-2001 The Cryptix Foundation Limited. * All rights reserved. @@ -527,6 +527,12 @@ a = new BigInteger(1, one ); b = new BigInteger(1, two ); + } catch(SecurityException se) { + // Braindamaged SUN restrictions + se.printStackTrace(System.err); + throw new RuntimeException("Not allowed to use ElGamal. " + + "Perhaps you need to download the Unlimited Strength " + + "Jurisdiction Policy Files from the Sun website? " + se); } catch(InvalidKeyException ivk) { // We construct the keys ourselves, so this shouldn't happen. throw new InternalError("Key was invalid:"); @@ -581,6 +587,13 @@ System.arraycopy(two, 0, ct, one.length, two.length); return cipher.doFinal( ct ); + + } catch(SecurityException se) { + // Braindamaged SUN restrictions + se.printStackTrace(System.err); + throw new RuntimeException("Not allowed to use ElGamal. " + + "Perhaps you need to download the Unlimited Strength " + + "Jurisdiction Policy Files from the Sun website? " + se); } catch(IllegalArgumentException iae) { // PGPMPI.toFixedLenByteArray throws this one when m is negative // (won't happen) or when m is larger than cipherBlockSize (this 1.22 +15 -1 projects/openpgp/src/cryptix/openpgp/algorithm/PGPRSA.java Index: PGPRSA.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/openpgp/src/cryptix/openpgp/algorithm/PGPRSA.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- PGPRSA.java 31 Jan 2003 00:52:24 -0000 1.21 +++ PGPRSA.java 23 Aug 2003 01:41:02 -0000 1.22 @@ -1,4 +1,4 @@ -/* $Id: PGPRSA.java,v 1.21 2003/01/31 00:52:24 edwin Exp $ +/* $Id: PGPRSA.java,v 1.22 2003/08/23 01:41:02 edwin Exp $ * * Copyright (C) 1999-2001 The Cryptix Foundation Limited. * All rights reserved. @@ -508,6 +508,13 @@ byte[] encrypted = cipher.doFinal(data); m = new BigInteger(1, encrypted ); + + } catch(SecurityException se) { + // Braindamaged SUN restrictions + se.printStackTrace(System.err); + throw new RuntimeException("Not allowed to use RSA. " + + "Perhaps you need to download the Unlimited Strength " + + "Jurisdiction Policy Files from the Sun website? " + se); } catch(InvalidKeyException ivk) { // We construct the keys ourselves, so this shouldn't happen. throw new InternalError("Key was invalid:"); @@ -555,6 +562,13 @@ byte[] ct = PGPMPI.toFixedLenByteArray(this.m, cipherBlockSize); return cipher.doFinal( ct ); + + } catch(SecurityException se) { + // Braindamaged SUN restrictions + se.printStackTrace(System.err); + throw new RuntimeException("Not allowed to use RSA. " + + "Perhaps you need to download the Unlimited Strength " + + "Jurisdiction Policy Files from the Sun website? " + se); } catch(IllegalArgumentException iae) { // PGPMPI.toFixedLenByteArray throws this one when m is negative // (won't happen) or when m is larger than cipherBlockSize (this |