equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2019, 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 |
194 private static Signature getSignature(String algorithm, |
194 private static Signature getSignature(String algorithm, |
195 Key key) throws GeneralSecurityException { |
195 Key key) throws GeneralSecurityException { |
196 Signature signer = null; |
196 Signature signer = null; |
197 switch (algorithm) { |
197 switch (algorithm) { |
198 case "RSA": |
198 case "RSA": |
199 signer = JsseJce.getSignature(JsseJce.SIGNATURE_RAWRSA); |
199 signer = Signature.getInstance(JsseJce.SIGNATURE_RAWRSA); |
200 break; |
200 break; |
201 case "DSA": |
201 case "DSA": |
202 signer = JsseJce.getSignature(JsseJce.SIGNATURE_RAWDSA); |
202 signer = Signature.getInstance(JsseJce.SIGNATURE_RAWDSA); |
203 break; |
203 break; |
204 case "EC": |
204 case "EC": |
205 signer = JsseJce.getSignature(JsseJce.SIGNATURE_RAWECDSA); |
205 signer = Signature.getInstance(JsseJce.SIGNATURE_RAWECDSA); |
206 break; |
206 break; |
207 default: |
207 default: |
208 throw new SignatureException("Unrecognized algorithm: " |
208 throw new SignatureException("Unrecognized algorithm: " |
209 + algorithm); |
209 + algorithm); |
210 } |
210 } |
437 private static Signature getSignature(String algorithm, |
437 private static Signature getSignature(String algorithm, |
438 Key key) throws GeneralSecurityException { |
438 Key key) throws GeneralSecurityException { |
439 Signature signer = null; |
439 Signature signer = null; |
440 switch (algorithm) { |
440 switch (algorithm) { |
441 case "RSA": |
441 case "RSA": |
442 signer = JsseJce.getSignature(JsseJce.SIGNATURE_RAWRSA); |
442 signer = Signature.getInstance(JsseJce.SIGNATURE_RAWRSA); |
443 break; |
443 break; |
444 case "DSA": |
444 case "DSA": |
445 signer = JsseJce.getSignature(JsseJce.SIGNATURE_RAWDSA); |
445 signer = Signature.getInstance(JsseJce.SIGNATURE_RAWDSA); |
446 break; |
446 break; |
447 case "EC": |
447 case "EC": |
448 signer = JsseJce.getSignature(JsseJce.SIGNATURE_RAWECDSA); |
448 signer = Signature.getInstance(JsseJce.SIGNATURE_RAWECDSA); |
449 break; |
449 break; |
450 default: |
450 default: |
451 throw new SignatureException("Unrecognized algorithm: " |
451 throw new SignatureException("Unrecognized algorithm: " |
452 + algorithm); |
452 + algorithm); |
453 } |
453 } |