< prev index next >

src/java.base/share/classes/sun/security/pkcs/SignerInfo.java

Print this page
rev 15871 : 8163304: jarsigner -verbose -verify should print the algorithms used to sign the jar

*** 496,505 **** --- 496,522 ---- public PKCS9Attributes getUnauthenticatedAttributes() { return unauthenticatedAttributes; } + /** + * Returns the timestamp PKCS7 data unverified. + * @return a PKCS7 object + */ + public PKCS7 getTsToken() throws IOException { + if (unauthenticatedAttributes == null) { + return null; + } + PKCS9Attribute tsTokenAttr = + unauthenticatedAttributes.getAttribute( + PKCS9Attribute.SIGNATURE_TIMESTAMP_TOKEN_OID); + if (tsTokenAttr == null) { + return null; + } + return new PKCS7((byte[])tsTokenAttr.getValue()); + } + /* * Extracts a timestamp from a PKCS7 SignerInfo. * * Examines the signer's unsigned attributes for a * {@code signatureTimestampToken} attribute. If present,
*** 523,545 **** CertificateException { if (timestamp != null || !hasTimestamp) return timestamp; ! if (unauthenticatedAttributes == null) { ! hasTimestamp = false; ! return null; ! } ! PKCS9Attribute tsTokenAttr = ! unauthenticatedAttributes.getAttribute( ! PKCS9Attribute.SIGNATURE_TIMESTAMP_TOKEN_OID); ! if (tsTokenAttr == null) { hasTimestamp = false; return null; } - PKCS7 tsToken = new PKCS7((byte[])tsTokenAttr.getValue()); // Extract the content (an encoded timestamp token info) byte[] encTsTokenInfo = tsToken.getContentInfo().getData(); // Extract the signer (the Timestamping Authority) // while verifying the content SignerInfo[] tsa = tsToken.verify(encTsTokenInfo); --- 540,555 ---- CertificateException { if (timestamp != null || !hasTimestamp) return timestamp; ! PKCS7 tsToken = getTsToken(); ! if (tsToken == null) { hasTimestamp = false; return null; } // Extract the content (an encoded timestamp token info) byte[] encTsTokenInfo = tsToken.getContentInfo().getData(); // Extract the signer (the Timestamping Authority) // while verifying the content SignerInfo[] tsa = tsToken.verify(encTsTokenInfo);
< prev index next >