jdk/src/java.base/share/classes/javax/crypto/Mac.java
changeset 26736 5a93000b26cd
parent 25859 3317bb8137f4
child 32275 17eeb583a331
equal deleted inserted replaced
26735:4502faa0cc22 26736:5a93000b26cd
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    74 
    74 
    75 public class Mac implements Cloneable {
    75 public class Mac implements Cloneable {
    76 
    76 
    77     private static final Debug debug =
    77     private static final Debug debug =
    78                         Debug.getInstance("jca", "Mac");
    78                         Debug.getInstance("jca", "Mac");
       
    79 
       
    80     private static final Debug pdebug =
       
    81                         Debug.getInstance("provider", "Provider");
       
    82     private static final boolean skipDebug =
       
    83         Debug.isOn("engine=") && !Debug.isOn("mac");
    79 
    84 
    80     // The provider
    85     // The provider
    81     private Provider provider;
    86     private Provider provider;
    82 
    87 
    83     // The provider implementation (delegate)
    88     // The provider implementation (delegate)
   411             }
   416             }
   412         } catch (InvalidAlgorithmParameterException e) {
   417         } catch (InvalidAlgorithmParameterException e) {
   413             throw new InvalidKeyException("init() failed", e);
   418             throw new InvalidKeyException("init() failed", e);
   414         }
   419         }
   415         initialized = true;
   420         initialized = true;
       
   421 
       
   422         if (!skipDebug && pdebug != null) {
       
   423             pdebug.println("Mac." + algorithm + " algorithm from: " +
       
   424                 this.provider.getName());
       
   425         }
   416     }
   426     }
   417 
   427 
   418     /**
   428     /**
   419      * Initializes this <code>Mac</code> object with the given key and
   429      * Initializes this <code>Mac</code> object with the given key and
   420      * algorithm parameters.
   430      * algorithm parameters.
   433             spi.engineInit(key, params);
   443             spi.engineInit(key, params);
   434         } else {
   444         } else {
   435             chooseProvider(key, params);
   445             chooseProvider(key, params);
   436         }
   446         }
   437         initialized = true;
   447         initialized = true;
       
   448 
       
   449         if (!skipDebug && pdebug != null) {
       
   450             pdebug.println("Mac." + algorithm + " algorithm from: " +
       
   451                 this.provider.getName());
       
   452         }
   438     }
   453     }
   439 
   454 
   440     /**
   455     /**
   441      * Processes the given byte.
   456      * Processes the given byte.
   442      *
   457      *