Add isExtensionPresent and getExtension.

This commit is contained in:
nicolson%netscape.com 2002-11-08 00:40:26 +00:00
Родитель 88cccc35d9
Коммит 2a0afd7964
1 изменённых файлов: 25 добавлений и 0 удалений

Просмотреть файл

@ -274,6 +274,31 @@ public class CertificateInfo implements ASN1Value {
return extensions;
}
/**
* Linearly searches the extension list for an extension with the given
* object identifier. If it finds one, returns <tt>true</tt>. Otherwise,
* returns <tt>false</tt>.
*/
public boolean isExtensionPresent(OBJECT_IDENTIFIER oid) {
return ( getExtension(oid) != null );
}
/**
* Linearly searches the extension list for an extension with the given
* object identifier. It returns the first one it finds. If none are found,
* returns <tt>null</tt>.
*/
public Extension getExtension(OBJECT_IDENTIFIER oid) {
int numExtensions = extensions.size();
for( int i=0; i < numExtensions; ++i) {
Extension ext = (Extension) extensions.elementAt(i);
if( oid.equals(ext.getExtnId()) ) {
return ext;
}
}
return null;
}
/**
* @exception CertificateException If the certificate is not a v3
* certificate.