use of java.security.cert.PolicyQualifierInfo in project robovm by robovm.
the class PolicyQualifierInfoTest method testGetPolicyQualifier02.
/**
* Test #2 for <code>getPolicyQualifier()</code> method
* Assertion: a copy is returned each time
*
* @throws IOException
*/
public final void testGetPolicyQualifier02() throws IOException {
// get valid encoding
byte[] encoding = getDerEncoding();
// get policy qualifier encoding
byte[] pqEncoding = new byte[28];
System.arraycopy(encoding, 12, pqEncoding, 0, pqEncoding.length);
// pass valid array
PolicyQualifierInfo i = new PolicyQualifierInfo(encoding);
// get encoding
byte[] pqEncodingRet = i.getPolicyQualifier();
// modify returned array
pqEncodingRet[0] = (byte) 0;
// get encoding again
byte[] pqEncodingRet1 = i.getPolicyQualifier();
//
assertNotSame(pqEncodingRet, pqEncodingRet1);
// check that above modification did not change
// internal state of the PolicyQualifierInfo instance
assertTrue(Arrays.equals(pqEncoding, pqEncodingRet1));
}
use of java.security.cert.PolicyQualifierInfo in project XobotOS by xamarin.
the class CertPathValidatorUtilities method getQualifierSet.
// crl checking
//
// policy checking
//
protected static final Set getQualifierSet(ASN1Sequence qualifiers) throws CertPathValidatorException {
Set pq = new HashSet();
if (qualifiers == null) {
return pq;
}
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ASN1OutputStream aOut = new ASN1OutputStream(bOut);
Enumeration e = qualifiers.getObjects();
while (e.hasMoreElements()) {
try {
aOut.writeObject(e.nextElement());
pq.add(new PolicyQualifierInfo(bOut.toByteArray()));
} catch (IOException ex) {
throw new ExtCertPathValidatorException("Policy qualifier info cannot be decoded.", ex);
}
bOut.reset();
}
return pq;
}
use of java.security.cert.PolicyQualifierInfo in project jdk8u_jdk by JetBrains.
the class PolicyInformation method encode.
/**
* Write the PolicyInformation to the DerOutputStream.
*
* @param out the DerOutputStream to write the extension to.
* @exception IOException on encoding errors.
*/
public void encode(DerOutputStream out) throws IOException {
DerOutputStream tmp = new DerOutputStream();
policyIdentifier.encode(tmp);
if (!policyQualifiers.isEmpty()) {
DerOutputStream tmp2 = new DerOutputStream();
for (PolicyQualifierInfo pq : policyQualifiers) {
tmp2.write(pq.getEncoded());
}
tmp.write(DerValue.tag_Sequence, tmp2);
}
out.write(DerValue.tag_Sequence, tmp);
}
use of java.security.cert.PolicyQualifierInfo in project j2objc by google.
the class PolicyInformation method encode.
/**
* Write the PolicyInformation to the DerOutputStream.
*
* @param out the DerOutputStream to write the extension to.
* @exception IOException on encoding errors.
*/
public void encode(DerOutputStream out) throws IOException {
DerOutputStream tmp = new DerOutputStream();
policyIdentifier.encode(tmp);
if (!policyQualifiers.isEmpty()) {
DerOutputStream tmp2 = new DerOutputStream();
for (PolicyQualifierInfo pq : policyQualifiers) {
tmp2.write(pq.getEncoded());
}
tmp.write(DerValue.tag_Sequence, tmp2);
}
out.write(DerValue.tag_Sequence, tmp);
}
use of java.security.cert.PolicyQualifierInfo in project robovm by robovm.
the class CertPathValidatorUtilities method getQualifierSet.
// crl checking
//
// policy checking
//
protected static final Set getQualifierSet(ASN1Sequence qualifiers) throws CertPathValidatorException {
Set pq = new HashSet();
if (qualifiers == null) {
return pq;
}
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ASN1OutputStream aOut = new ASN1OutputStream(bOut);
Enumeration e = qualifiers.getObjects();
while (e.hasMoreElements()) {
try {
aOut.writeObject((ASN1Encodable) e.nextElement());
pq.add(new PolicyQualifierInfo(bOut.toByteArray()));
} catch (IOException ex) {
throw new ExtCertPathValidatorException("Policy qualifier info cannot be decoded.", ex);
}
bOut.reset();
}
return pq;
}
Aggregations