< prev index next >

src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java

Print this page




  95         System.arraycopy(b2, 0, b, n1, n2);
  96         return b;
  97     }
  98 
  99     private static byte[][] genConst() {
 100         int n = 10;
 101         byte[][] arr = new byte[n][];
 102         for (int i = 0; i < n; i++) {
 103             byte[] b = new byte[i + 1];
 104             Arrays.fill(b, (byte)('A' + i));
 105             arr[i] = b;
 106         }
 107         return arr;
 108     }
 109 
 110     // PRF implementation
 111 
 112     private final static String MSG = "TlsPrfGenerator must be "
 113         + "initialized using a TlsPrfParameterSpec";
 114 

 115     private TlsPrfParameterSpec spec;
 116 
 117     public TlsPrfGenerator() {
 118     }
 119 
 120     protected void engineInit(SecureRandom random) {
 121         throw new InvalidParameterException(MSG);
 122     }
 123 

 124     protected void engineInit(AlgorithmParameterSpec params,
 125             SecureRandom random) throws InvalidAlgorithmParameterException {
 126         if (params instanceof TlsPrfParameterSpec == false) {
 127             throw new InvalidAlgorithmParameterException(MSG);
 128         }
 129         this.spec = (TlsPrfParameterSpec)params;
 130         SecretKey key = spec.getSecret();
 131         if ((key != null) && ("RAW".equals(key.getFormat()) == false)) {
 132             throw new InvalidAlgorithmParameterException(
 133                 "Key encoding format must be RAW");
 134         }
 135     }
 136 
 137     protected void engineInit(int keysize, SecureRandom random) {
 138         throw new InvalidParameterException(MSG);
 139     }
 140 
 141     SecretKey engineGenerateKey0(boolean tls12) {
 142         if (spec == null) {
 143             throw new IllegalStateException(




  95         System.arraycopy(b2, 0, b, n1, n2);
  96         return b;
  97     }
  98 
  99     private static byte[][] genConst() {
 100         int n = 10;
 101         byte[][] arr = new byte[n][];
 102         for (int i = 0; i < n; i++) {
 103             byte[] b = new byte[i + 1];
 104             Arrays.fill(b, (byte)('A' + i));
 105             arr[i] = b;
 106         }
 107         return arr;
 108     }
 109 
 110     // PRF implementation
 111 
 112     private final static String MSG = "TlsPrfGenerator must be "
 113         + "initialized using a TlsPrfParameterSpec";
 114 
 115     @SuppressWarnings("deprecation")
 116     private TlsPrfParameterSpec spec;
 117 
 118     public TlsPrfGenerator() {
 119     }
 120 
 121     protected void engineInit(SecureRandom random) {
 122         throw new InvalidParameterException(MSG);
 123     }
 124 
 125     @SuppressWarnings("deprecation")
 126     protected void engineInit(AlgorithmParameterSpec params,
 127             SecureRandom random) throws InvalidAlgorithmParameterException {
 128         if (params instanceof TlsPrfParameterSpec == false) {
 129             throw new InvalidAlgorithmParameterException(MSG);
 130         }
 131         this.spec = (TlsPrfParameterSpec)params;
 132         SecretKey key = spec.getSecret();
 133         if ((key != null) && ("RAW".equals(key.getFormat()) == false)) {
 134             throw new InvalidAlgorithmParameterException(
 135                 "Key encoding format must be RAW");
 136         }
 137     }
 138 
 139     protected void engineInit(int keysize, SecureRandom random) {
 140         throw new InvalidParameterException(MSG);
 141     }
 142 
 143     SecretKey engineGenerateKey0(boolean tls12) {
 144         if (spec == null) {
 145             throw new IllegalStateException(


< prev index next >