< prev index next >

test/jdk/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java

Print this page
rev 59107 : imported patch security


  92     @Override
  93     public void main(Provider p) throws Exception {
  94         test("DES", 0, p, TestResult.FAIL);
  95         test("DES", 56, p, TestResult.PASS); // ensure JCE-Compatibility
  96         test("DES", 64, p, TestResult.PASS);
  97         test("DES", 128, p, TestResult.FAIL);
  98 
  99         test("DESede", 0, p, TestResult.FAIL);
 100         // Special handling since not all PKCS11 providers support
 101         // 2-key DESede, e.g. SunPKCS11-Solaris.
 102         TestResult temp = test("DESede", 112, p, TestResult.TBD);
 103         test("DESede", 128, p, temp);
 104         test("DESede", 168, p, TestResult.PASS);
 105         test("DESede", 192, p, TestResult.PASS);
 106         test("DESede", 64, p, TestResult.FAIL);
 107         test("DESede", 256, p, TestResult.FAIL);
 108 
 109         // Different PKCS11 impls have different ranges
 110         // of supported key sizes for variable-key-length
 111         // algorithms.
 112         // Solaris> Blowfish: 32-128 or even 448 bits, RC4: 8-128 bits or as much as 2048 bits
 113         // NSS>     Blowfish: n/a,         RC4: 8-2048 bits
 114         // However, we explicitly disallowed key sizes less
 115         // than 40-bits.
 116 
 117         test("Blowfish", 0, p, TestResult.FAIL);
 118         test("Blowfish", 24, p, TestResult.FAIL);
 119         test("Blowfish", 32, p, TestResult.FAIL);
 120         test("Blowfish", 40, p, TestResult.PASS);
 121         test("Blowfish", 128, p, TestResult.PASS);
 122         test("Blowfish", 136, p, TestResult.TBD);
 123         test("Blowfish", 448, p, TestResult.TBD);
 124         test("Blowfish", 456, p, TestResult.FAIL);
 125 
 126         test("ARCFOUR", 0, p, TestResult.FAIL);
 127         test("ARCFOUR", 32, p, TestResult.FAIL);
 128         test("ARCFOUR", 40, p, TestResult.PASS);
 129         test("ARCFOUR", 128, p, TestResult.PASS);
 130 
 131         if (p.getName().equals("SunPKCS11-Solaris")) {
 132             test("ARCFOUR", 1024, p, TestResult.TBD);
 133         } else if (p.getName().equals("SunPKCS11-NSS")) {
 134             test("ARCFOUR", 1024, p, TestResult.PASS);
 135             test("ARCFOUR", 2048, p, TestResult.PASS);
 136             test("ARCFOUR", 2056, p, TestResult.FAIL);
 137         }
 138     }
 139 }


  92     @Override
  93     public void main(Provider p) throws Exception {
  94         test("DES", 0, p, TestResult.FAIL);
  95         test("DES", 56, p, TestResult.PASS); // ensure JCE-Compatibility
  96         test("DES", 64, p, TestResult.PASS);
  97         test("DES", 128, p, TestResult.FAIL);
  98 
  99         test("DESede", 0, p, TestResult.FAIL);
 100         // Special handling since not all PKCS11 providers support
 101         // 2-key DESede, e.g. SunPKCS11-Solaris.
 102         TestResult temp = test("DESede", 112, p, TestResult.TBD);
 103         test("DESede", 128, p, temp);
 104         test("DESede", 168, p, TestResult.PASS);
 105         test("DESede", 192, p, TestResult.PASS);
 106         test("DESede", 64, p, TestResult.FAIL);
 107         test("DESede", 256, p, TestResult.FAIL);
 108 
 109         // Different PKCS11 impls have different ranges
 110         // of supported key sizes for variable-key-length
 111         // algorithms.

 112         // NSS>     Blowfish: n/a,         RC4: 8-2048 bits
 113         // However, we explicitly disallowed key sizes less
 114         // than 40-bits.
 115 
 116         test("Blowfish", 0, p, TestResult.FAIL);
 117         test("Blowfish", 24, p, TestResult.FAIL);
 118         test("Blowfish", 32, p, TestResult.FAIL);
 119         test("Blowfish", 40, p, TestResult.PASS);
 120         test("Blowfish", 128, p, TestResult.PASS);
 121         test("Blowfish", 136, p, TestResult.TBD);
 122         test("Blowfish", 448, p, TestResult.TBD);
 123         test("Blowfish", 456, p, TestResult.FAIL);
 124 
 125         test("ARCFOUR", 0, p, TestResult.FAIL);
 126         test("ARCFOUR", 32, p, TestResult.FAIL);
 127         test("ARCFOUR", 40, p, TestResult.PASS);
 128         test("ARCFOUR", 128, p, TestResult.PASS);
 129 
 130         if (p.getName().equals("SunPKCS11-NSS")) {


 131             test("ARCFOUR", 1024, p, TestResult.PASS);
 132             test("ARCFOUR", 2048, p, TestResult.PASS);
 133             test("ARCFOUR", 2056, p, TestResult.FAIL);
 134         }
 135     }
 136 }
< prev index next >