зеркало из https://github.com/mozilla/pjs.git
Add isExtensionPresent and getExtension.
This commit is contained in:
Родитель
88cccc35d9
Коммит
2a0afd7964
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче