src/windows/classes/sun/security/provider/NativeSeedGenerator.java

Print this page




  38      *
  39      * @exception IOException if CryptoAPI seeds are not available
  40      * on this platform.
  41      */
  42     NativeSeedGenerator(String seedFile) throws IOException {
  43         // seedFile is ignored.
  44         super();
  45         // try generating two random bytes to see if CAPI is available
  46         if (!nativeGenerateSeed(new byte[2])) {
  47             throw new IOException("Required native CryptoAPI features not "
  48                                   + " available on this machine");
  49         }
  50     }
  51 
  52     /**
  53      * Native method to do the actual work.
  54      */
  55     private static native boolean nativeGenerateSeed(byte[] result);
  56 
  57     @Override
  58     void getSeedBytes(byte[] result) {
  59         // fill array as a side effect
  60         if (nativeGenerateSeed(result) == false) {
  61             // should never happen if constructor check succeeds
  62             throw new InternalError
  63                             ("Unexpected CryptoAPI failure generating seed");
  64         }
  65     }
  66 
  67 }


  38      *
  39      * @exception IOException if CryptoAPI seeds are not available
  40      * on this platform.
  41      */
  42     NativeSeedGenerator(String seedFile) throws IOException {
  43         // seedFile is ignored.
  44         super();
  45         // try generating two random bytes to see if CAPI is available
  46         if (!nativeGenerateSeed(new byte[2])) {
  47             throw new IOException("Required native CryptoAPI features not "
  48                                   + " available on this machine");
  49         }
  50     }
  51 
  52     /**
  53      * Native method to do the actual work.
  54      */
  55     private static native boolean nativeGenerateSeed(byte[] result);
  56 
  57     @Override
  58     public void getSeedBytes(byte[] result) {
  59         // fill array as a side effect
  60         if (nativeGenerateSeed(result) == false) {
  61             // should never happen if constructor check succeeds
  62             throw new InternalError
  63                             ("Unexpected CryptoAPI failure generating seed");
  64         }
  65     }
  66 
  67 }