@@ -72,11 +72,15 @@ public class SignerInfoWithPkey implements ASN1Encodable {
72
72
private ASN1OctetString encryptedDigest ;
73
73
private ASN1Set unauthenticatedAttributes ;
74
74
75
- public static SignerInfoWithPkey getInstance (Object o ) {
76
- if (o instanceof SignerInfo ) {
77
- return (SignerInfoWithPkey )o ;
78
- } else if (o instanceof ASN1Sequence ) {
79
- return new SignerInfoWithPkey ((ASN1Sequence )o );
75
+ public static SignerInfoWithPkey getInstance (ASN1Encodable o ) {
76
+ if (o instanceof SignerInfo ) {
77
+ final SignerInfo info = (SignerInfo ) o ;
78
+ return new SignerInfoWithPkey (info .getVersion (), info .getIssuerAndSerialNumber (), info .getDigestAlgorithm (),
79
+ info .getAuthenticatedAttributes (), info .getDigestEncryptionAlgorithm (),
80
+ info .getEncryptedDigest (), info .getUnauthenticatedAttributes ());
81
+ }
82
+ if (o instanceof ASN1Sequence ) {
83
+ return new SignerInfoWithPkey ((ASN1Sequence ) o );
80
84
}
81
85
82
86
throw new IllegalArgumentException ("unknown object in factory: " + o .getClass ().getName ());
@@ -97,13 +101,13 @@ public SignerInfoWithPkey dup() {
97
101
SignerInfoWithPkey () {
98
102
}
99
103
100
- public SignerInfoWithPkey (ASN1Integer version ,
101
- IssuerAndSerialNumber issuerAndSerialNumber ,
102
- AlgorithmIdentifier digAlgorithm ,
103
- ASN1Set authenticatedAttributes ,
104
- AlgorithmIdentifier digEncryptionAlgorithm ,
105
- ASN1OctetString encryptedDigest ,
106
- ASN1Set unauthenticatedAttributes ) {
104
+ public SignerInfoWithPkey (ASN1Integer version ,
105
+ IssuerAndSerialNumber issuerAndSerialNumber ,
106
+ AlgorithmIdentifier digAlgorithm ,
107
+ ASN1Set authenticatedAttributes ,
108
+ AlgorithmIdentifier digEncryptionAlgorithm ,
109
+ ASN1OctetString encryptedDigest ,
110
+ ASN1Set unauthenticatedAttributes ) {
107
111
this .version = version ;
108
112
this .issuerAndSerialNumber = issuerAndSerialNumber ;
109
113
this .digAlgorithm = digAlgorithm ;
@@ -113,16 +117,16 @@ public SignerInfoWithPkey(ASN1Integer version,
113
117
this .unauthenticatedAttributes = unauthenticatedAttributes ;
114
118
}
115
119
116
- public SignerInfoWithPkey (ASN1Sequence seq ) {
117
- Enumeration e = seq .getObjects ();
120
+ SignerInfoWithPkey (ASN1Sequence seq ) {
121
+ Enumeration e = seq .getObjects ();
118
122
119
123
version = (ASN1Integer )e .nextElement ();
120
124
issuerAndSerialNumber = IssuerAndSerialNumber .getInstance (e .nextElement ());
121
125
digAlgorithm = AlgorithmIdentifier .getInstance (e .nextElement ());
122
126
123
127
Object obj = e .nextElement ();
124
128
125
- if (obj instanceof ASN1TaggedObject ) {
129
+ if (obj instanceof ASN1TaggedObject ) {
126
130
authenticatedAttributes = ASN1Set .getInstance ((ASN1TaggedObject )obj , false );
127
131
128
132
digEncryptionAlgorithm = AlgorithmIdentifier .getInstance (e .nextElement ());
0 commit comments