179 // Several AlgorithmId should omit the whole parameter part when
180 // it's NULL. They are ---
181 // RFC 3370 2.1: Implementations SHOULD generate SHA-1
182 // AlgorithmIdentifiers with absent parameters.
183 // RFC 3447 C1: When id-sha1, id-sha224, id-sha256, id-sha384 and
184 // id-sha512 are used in an AlgorithmIdentifier the parameters
185 // (which are optional) SHOULD be omitted.
186 // RFC 3279 2.3.2: The id-dsa algorithm syntax includes optional
187 // domain parameters... When omitted, the parameters component
188 // MUST be omitted entirely
189 // RFC 3370 3.1: When the id-dsa-with-sha1 algorithm identifier
190 // is used, the AlgorithmIdentifier parameters field MUST be absent.
191 /*if (
192 algid.equals((Object)SHA_oid) ||
193 algid.equals((Object)SHA224_oid) ||
194 algid.equals((Object)SHA256_oid) ||
195 algid.equals((Object)SHA384_oid) ||
196 algid.equals((Object)SHA512_oid) ||
197 algid.equals((Object)SHA512_224_oid) ||
198 algid.equals((Object)SHA512_256_oid) ||
199 algid.equals((Object)DSA_oid) ||
200 algid.equals((Object)sha1WithDSA_oid)) {
201 ; // no parameter part encoded
202 } else {
203 bytes.putNull();
204 }*/
205 if (algid.equals(RSASSA_PSS_oid) || algid.equals(ed448_oid)
206 || algid.equals(ed25519_oid)) {
207 // RFC 4055 3.3: when an RSASSA-PSS key does not require
208 // parameter validation, field is absent.
209 } else {
210 bytes.putNull();
211 }
212 } else {
213 bytes.putDerValue(params);
214 }
215 tmp.write(DerValue.tag_Sequence, bytes);
216 out.write(tmp.toByteArray());
217 }
218
591 ObjectIdentifier.of(KnownOIDs.SHA_1);
592
593 public static final ObjectIdentifier SHA224_oid =
594 ObjectIdentifier.of(KnownOIDs.SHA_224);
595
596 public static final ObjectIdentifier SHA256_oid =
597 ObjectIdentifier.of(KnownOIDs.SHA_256);
598
599 public static final ObjectIdentifier SHA384_oid =
600 ObjectIdentifier.of(KnownOIDs.SHA_384);
601
602 public static final ObjectIdentifier SHA512_oid =
603 ObjectIdentifier.of(KnownOIDs.SHA_512);
604
605 public static final ObjectIdentifier SHA512_224_oid =
606 ObjectIdentifier.of(KnownOIDs.SHA_512$224);
607
608 public static final ObjectIdentifier SHA512_256_oid =
609 ObjectIdentifier.of(KnownOIDs.SHA_512$256);
610
611 public static final ObjectIdentifier DSA_oid =
612 ObjectIdentifier.of(KnownOIDs.DSA);
613
614 public static final ObjectIdentifier EC_oid =
615 ObjectIdentifier.of(KnownOIDs.EC);
616
617 public static final ObjectIdentifier RSAEncryption_oid =
618 ObjectIdentifier.of(KnownOIDs.RSA);
619
620 public static final ObjectIdentifier RSASSA_PSS_oid =
621 ObjectIdentifier.of(KnownOIDs.RSASSA_PSS);
622
623 public static final ObjectIdentifier MGF1_oid =
624 ObjectIdentifier.of(KnownOIDs.MGF1);
625
626 public static final ObjectIdentifier ed25519_oid =
627 ObjectIdentifier.of(KnownOIDs.Ed25519);
628 public static final ObjectIdentifier ed448_oid =
629 ObjectIdentifier.of(KnownOIDs.Ed448);
630
|
179 // Several AlgorithmId should omit the whole parameter part when
180 // it's NULL. They are ---
181 // RFC 3370 2.1: Implementations SHOULD generate SHA-1
182 // AlgorithmIdentifiers with absent parameters.
183 // RFC 3447 C1: When id-sha1, id-sha224, id-sha256, id-sha384 and
184 // id-sha512 are used in an AlgorithmIdentifier the parameters
185 // (which are optional) SHOULD be omitted.
186 // RFC 3279 2.3.2: The id-dsa algorithm syntax includes optional
187 // domain parameters... When omitted, the parameters component
188 // MUST be omitted entirely
189 // RFC 3370 3.1: When the id-dsa-with-sha1 algorithm identifier
190 // is used, the AlgorithmIdentifier parameters field MUST be absent.
191 /*if (
192 algid.equals((Object)SHA_oid) ||
193 algid.equals((Object)SHA224_oid) ||
194 algid.equals((Object)SHA256_oid) ||
195 algid.equals((Object)SHA384_oid) ||
196 algid.equals((Object)SHA512_oid) ||
197 algid.equals((Object)SHA512_224_oid) ||
198 algid.equals((Object)SHA512_256_oid) ||
199 algid.equals((Object)SHA3_224_oid) ||
200 algid.equals((Object)SHA3_256_oid) ||
201 algid.equals((Object)SHA3_384_oid) ||
202 algid.equals((Object)SHA3_512_oid) ||
203 algid.equals((Object)DSA_oid) ||
204 algid.equals((Object)sha1WithDSA_oid)) {
205 ; // no parameter part encoded
206 } else {
207 bytes.putNull();
208 }*/
209 if (algid.equals(RSASSA_PSS_oid) || algid.equals(ed448_oid)
210 || algid.equals(ed25519_oid)) {
211 // RFC 4055 3.3: when an RSASSA-PSS key does not require
212 // parameter validation, field is absent.
213 } else {
214 bytes.putNull();
215 }
216 } else {
217 bytes.putDerValue(params);
218 }
219 tmp.write(DerValue.tag_Sequence, bytes);
220 out.write(tmp.toByteArray());
221 }
222
595 ObjectIdentifier.of(KnownOIDs.SHA_1);
596
597 public static final ObjectIdentifier SHA224_oid =
598 ObjectIdentifier.of(KnownOIDs.SHA_224);
599
600 public static final ObjectIdentifier SHA256_oid =
601 ObjectIdentifier.of(KnownOIDs.SHA_256);
602
603 public static final ObjectIdentifier SHA384_oid =
604 ObjectIdentifier.of(KnownOIDs.SHA_384);
605
606 public static final ObjectIdentifier SHA512_oid =
607 ObjectIdentifier.of(KnownOIDs.SHA_512);
608
609 public static final ObjectIdentifier SHA512_224_oid =
610 ObjectIdentifier.of(KnownOIDs.SHA_512$224);
611
612 public static final ObjectIdentifier SHA512_256_oid =
613 ObjectIdentifier.of(KnownOIDs.SHA_512$256);
614
615 public static final ObjectIdentifier SHA3_224_oid =
616 ObjectIdentifier.of(KnownOIDs.SHA3_224);
617
618 public static final ObjectIdentifier SHA3_256_oid =
619 ObjectIdentifier.of(KnownOIDs.SHA3_256);
620
621 public static final ObjectIdentifier SHA3_384_oid =
622 ObjectIdentifier.of(KnownOIDs.SHA3_384);
623
624 public static final ObjectIdentifier SHA3_512_oid =
625 ObjectIdentifier.of(KnownOIDs.SHA3_512);
626
627 public static final ObjectIdentifier DSA_oid =
628 ObjectIdentifier.of(KnownOIDs.DSA);
629
630 public static final ObjectIdentifier EC_oid =
631 ObjectIdentifier.of(KnownOIDs.EC);
632
633 public static final ObjectIdentifier RSAEncryption_oid =
634 ObjectIdentifier.of(KnownOIDs.RSA);
635
636 public static final ObjectIdentifier RSASSA_PSS_oid =
637 ObjectIdentifier.of(KnownOIDs.RSASSA_PSS);
638
639 public static final ObjectIdentifier MGF1_oid =
640 ObjectIdentifier.of(KnownOIDs.MGF1);
641
642 public static final ObjectIdentifier ed25519_oid =
643 ObjectIdentifier.of(KnownOIDs.Ed25519);
644 public static final ObjectIdentifier ed448_oid =
645 ObjectIdentifier.of(KnownOIDs.Ed448);
646
|