jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
changeset 12685 8a448b5b9006
parent 11521 d7698e6c5f51
child 17916 e02ddef88f77
equal deleted inserted replaced
12676:3b7fae360d04 12685:8a448b5b9006
    51  *   . SHA1withDSA
    51  *   . SHA1withDSA
    52  * . RSA:
    52  * . RSA:
    53  *   . MD2withRSA
    53  *   . MD2withRSA
    54  *   . MD5withRSA
    54  *   . MD5withRSA
    55  *   . SHA1withRSA
    55  *   . SHA1withRSA
       
    56  *   . SHA224withRSA
    56  *   . SHA256withRSA
    57  *   . SHA256withRSA
    57  *   . SHA384withRSA
    58  *   . SHA384withRSA
    58  *   . SHA512withRSA
    59  *   . SHA512withRSA
    59  * . ECDSA
    60  * . ECDSA
    60  *   . NONEwithECDSA
    61  *   . NONEwithECDSA
    61  *   . SHA1withECDSA
    62  *   . SHA1withECDSA
       
    63  *   . SHA224withECDSA
    62  *   . SHA256withECDSA
    64  *   . SHA256withECDSA
    63  *   . SHA384withECDSA
    65  *   . SHA384withECDSA
    64  *   . SHA512withECDSA
    66  *   . SHA512withECDSA
    65  *
    67  *
    66  * Note that the underlying PKCS#11 token may support complete signature
    68  * Note that the underlying PKCS#11 token may support complete signature
   141         MessageDigest md = null;
   143         MessageDigest md = null;
   142         switch ((int)mechanism) {
   144         switch ((int)mechanism) {
   143         case (int)CKM_MD2_RSA_PKCS:
   145         case (int)CKM_MD2_RSA_PKCS:
   144         case (int)CKM_MD5_RSA_PKCS:
   146         case (int)CKM_MD5_RSA_PKCS:
   145         case (int)CKM_SHA1_RSA_PKCS:
   147         case (int)CKM_SHA1_RSA_PKCS:
       
   148         case (int)CKM_SHA224_RSA_PKCS:
   146         case (int)CKM_SHA256_RSA_PKCS:
   149         case (int)CKM_SHA256_RSA_PKCS:
   147         case (int)CKM_SHA384_RSA_PKCS:
   150         case (int)CKM_SHA384_RSA_PKCS:
   148         case (int)CKM_SHA512_RSA_PKCS:
   151         case (int)CKM_SHA512_RSA_PKCS:
   149             keyAlgorithm = "RSA";
   152             keyAlgorithm = "RSA";
   150             type = T_UPDATE;
   153             type = T_UPDATE;
   179                 buffer = new byte[RAW_ECDSA_MAX];
   182                 buffer = new byte[RAW_ECDSA_MAX];
   180             } else {
   183             } else {
   181                 String digestAlg;
   184                 String digestAlg;
   182                 if (algorithm.equals("SHA1withECDSA")) {
   185                 if (algorithm.equals("SHA1withECDSA")) {
   183                     digestAlg = "SHA-1";
   186                     digestAlg = "SHA-1";
       
   187                 } else if (algorithm.equals("SHA224withECDSA")) {
       
   188                     digestAlg = "SHA-224";
   184                 } else if (algorithm.equals("SHA256withECDSA")) {
   189                 } else if (algorithm.equals("SHA256withECDSA")) {
   185                     digestAlg = "SHA-256";
   190                     digestAlg = "SHA-256";
   186                 } else if (algorithm.equals("SHA384withECDSA")) {
   191                 } else if (algorithm.equals("SHA384withECDSA")) {
   187                     digestAlg = "SHA-384";
   192                     digestAlg = "SHA-384";
   188                 } else if (algorithm.equals("SHA512withECDSA")) {
   193                 } else if (algorithm.equals("SHA512withECDSA")) {
   205                 md = MessageDigest.getInstance("SHA-1");
   210                 md = MessageDigest.getInstance("SHA-1");
   206                 digestOID = AlgorithmId.SHA_oid;
   211                 digestOID = AlgorithmId.SHA_oid;
   207             } else if (algorithm.equals("MD2withRSA")) {
   212             } else if (algorithm.equals("MD2withRSA")) {
   208                 md = MessageDigest.getInstance("MD2");
   213                 md = MessageDigest.getInstance("MD2");
   209                 digestOID = AlgorithmId.MD2_oid;
   214                 digestOID = AlgorithmId.MD2_oid;
       
   215             } else if (algorithm.equals("SHA224withRSA")) {
       
   216                 md = MessageDigest.getInstance("SHA-224");
       
   217                 digestOID = AlgorithmId.SHA224_oid;
   210             } else if (algorithm.equals("SHA256withRSA")) {
   218             } else if (algorithm.equals("SHA256withRSA")) {
   211                 md = MessageDigest.getInstance("SHA-256");
   219                 md = MessageDigest.getInstance("SHA-256");
   212                 digestOID = AlgorithmId.SHA256_oid;
   220                 digestOID = AlgorithmId.SHA256_oid;
   213             } else if (algorithm.equals("SHA384withRSA")) {
   221             } else if (algorithm.equals("SHA384withRSA")) {
   214                 md = MessageDigest.getInstance("SHA-384");
   222                 md = MessageDigest.getInstance("SHA-384");
   330         if (algorithm.equals("MD5withRSA") ||
   338         if (algorithm.equals("MD5withRSA") ||
   331             algorithm.equals("MD2withRSA")) {
   339             algorithm.equals("MD2withRSA")) {
   332             encodedLength = 34;
   340             encodedLength = 34;
   333         } else if (algorithm.equals("SHA1withRSA")) {
   341         } else if (algorithm.equals("SHA1withRSA")) {
   334             encodedLength = 35;
   342             encodedLength = 35;
       
   343         } else if (algorithm.equals("SHA224withRSA")) {
       
   344             encodedLength = 47;
   335         } else if (algorithm.equals("SHA256withRSA")) {
   345         } else if (algorithm.equals("SHA256withRSA")) {
   336             encodedLength = 51;
   346             encodedLength = 51;
   337         } else if (algorithm.equals("SHA384withRSA")) {
   347         } else if (algorithm.equals("SHA384withRSA")) {
   338             encodedLength = 67;
   348             encodedLength = 67;
   339         } else if (algorithm.equals("SHA512withRSA")) {
   349         } else if (algorithm.equals("SHA512withRSA")) {