equal
deleted
inserted
replaced
45 * Objects should be instantiated by calling Signature.getInstance() using the |
45 * Objects should be instantiated by calling Signature.getInstance() using the |
46 * following algorithm names: |
46 * following algorithm names: |
47 * |
47 * |
48 * . "NONEwithRSA" |
48 * . "NONEwithRSA" |
49 * . "SHA1withRSA" |
49 * . "SHA1withRSA" |
|
50 * . "SHA224withRSA" |
50 * . "SHA256withRSA" |
51 * . "SHA256withRSA" |
51 * . "SHA384withRSA" |
52 * . "SHA384withRSA" |
52 * . "SHA512withRSA" |
53 * . "SHA512withRSA" |
53 * . "MD5withRSA" |
54 * . "MD5withRSA" |
54 * . "MD2withRSA" |
55 * . "MD2withRSA" |
55 * |
56 * |
56 * NOTE: RSA keys must be at least 512 bits long. |
57 * NOTE: RSA keys must be at least 512 bits long. |
57 * |
58 * |
58 * NOTE: NONEwithRSA must be supplied with a pre-computed message digest. |
59 * NOTE: NONEwithRSA must be supplied with a pre-computed message digest. |
59 * Only the following digest algorithms are supported: MD5, SHA-1, |
60 * Only the following digest algorithms are supported: MD5, SHA-1, |
60 * SHA-256, SHA-384, SHA-512 and a special-purpose digest algorithm |
61 * SHA-224, SHA-256, SHA-384, SHA-512 and a special-purpose digest |
61 * which is a concatenation of SHA-1 and MD5 digests. |
62 * algorithm which is a concatenation of SHA-1 and MD5 digests. |
62 * |
63 * |
63 * @since 1.6 |
64 * @since 1.6 |
64 * @author Stanley Man-Kit Ho |
65 * @author Stanley Man-Kit Ho |
65 */ |
66 */ |
66 abstract class RSASignature extends java.security.SignatureSpi |
67 abstract class RSASignature extends java.security.SignatureSpi |
178 setDigestName("SHA-384"); |
179 setDigestName("SHA-384"); |
179 } else if (offset == 64) { |
180 } else if (offset == 64) { |
180 setDigestName("SHA-512"); |
181 setDigestName("SHA-512"); |
181 } else if (offset == 16) { |
182 } else if (offset == 16) { |
182 setDigestName("MD5"); |
183 setDigestName("MD5"); |
|
184 } else if (offset == 28) { |
|
185 setDigestName("SHA-224"); |
183 } else { |
186 } else { |
184 throw new SignatureException( |
187 throw new SignatureException( |
185 "Message digest length is not supported"); |
188 "Message digest length is not supported"); |
186 } |
189 } |
187 |
190 |
194 } |
197 } |
195 |
198 |
196 public static final class SHA1 extends RSASignature { |
199 public static final class SHA1 extends RSASignature { |
197 public SHA1() { |
200 public SHA1() { |
198 super("SHA1"); |
201 super("SHA1"); |
|
202 } |
|
203 } |
|
204 |
|
205 public static final class SHA224 extends RSASignature { |
|
206 public SHA224() { |
|
207 super("SHA-224"); |
199 } |
208 } |
200 } |
209 } |
201 |
210 |
202 public static final class SHA256 extends RSASignature { |
211 public static final class SHA256 extends RSASignature { |
203 public SHA256() { |
212 public SHA256() { |