equal
deleted
inserted
replaced
165 // |
165 // |
166 // OK, we parsed it all ... validate the signature using the |
166 // OK, we parsed it all ... validate the signature using the |
167 // key and signature algorithm we found. |
167 // key and signature algorithm we found. |
168 // |
168 // |
169 try { |
169 try { |
170 sig = Signature.getInstance(id.getName()); |
170 sigAlg = id.getName(); |
|
171 sig = Signature.getInstance(sigAlg); |
171 sig.initVerify(subjectPublicKeyInfo); |
172 sig.initVerify(subjectPublicKeyInfo); |
172 sig.update(data); |
173 sig.update(data); |
173 if (!sig.verify(sigData)) |
174 if (!sig.verify(sigData)) |
174 throw new SignatureException("Invalid PKCS #10 signature"); |
175 throw new SignatureException("Invalid PKCS #10 signature"); |
175 } catch (InvalidKeyException e) { |
176 } catch (InvalidKeyException e) { |
216 * Sign it ... |
217 * Sign it ... |
217 */ |
218 */ |
218 signature.update(certificateRequestInfo, 0, |
219 signature.update(certificateRequestInfo, 0, |
219 certificateRequestInfo.length); |
220 certificateRequestInfo.length); |
220 sig = signature.sign(); |
221 sig = signature.sign(); |
|
222 sigAlg = signature.getAlgorithm(); |
221 |
223 |
222 /* |
224 /* |
223 * Build guts of SIGNED macro |
225 * Build guts of SIGNED macro |
224 */ |
226 */ |
225 AlgorithmId algId = null; |
227 AlgorithmId algId = null; |
249 */ |
251 */ |
250 public PublicKey getSubjectPublicKeyInfo() |
252 public PublicKey getSubjectPublicKeyInfo() |
251 { return subjectPublicKeyInfo; } |
253 { return subjectPublicKeyInfo; } |
252 |
254 |
253 /** |
255 /** |
|
256 * Returns the signature algorithm. |
|
257 */ |
|
258 public String getSigAlg() { return sigAlg; } |
|
259 |
|
260 /** |
254 * Returns the additional attributes requested. |
261 * Returns the additional attributes requested. |
255 */ |
262 */ |
256 public PKCS10Attributes getAttributes() |
263 public PKCS10Attributes getAttributes() |
257 { return attributeSet; } |
264 { return attributeSet; } |
258 |
265 |
346 return(retval); |
353 return(retval); |
347 } |
354 } |
348 |
355 |
349 private X500Name subject; |
356 private X500Name subject; |
350 private PublicKey subjectPublicKeyInfo; |
357 private PublicKey subjectPublicKeyInfo; |
|
358 private String sigAlg; |
351 private PKCS10Attributes attributeSet; |
359 private PKCS10Attributes attributeSet; |
352 private byte[] encoded; // signed |
360 private byte[] encoded; // signed |
353 } |
361 } |