private boolean isValueAPReq(DerValue value) { return value.isConstructed((byte) Krb5.KRB_AP_REQ); }
public boolean verify(String hostname, SSLSession session) { HostnameChecker checker = HostnameChecker.getInstance(HostnameChecker.TYPE_TLS); try { Certificate[] peerCertificates = session.getPeerCertificates(); if (peerCertificates.length > 0 && peerCertificates[0] instanceof X509Certificate) { X509Certificate peerCertificate = (X509Certificate) peerCertificates[0]; try { checker.match(hostname, peerCertificate); return true; } catch (CertificateException ignored) { } } } catch (SSLPeerUnverifiedException ignored) { } return false; }
final byte[] clientToken = StringUtils.decodeBase64String(authorization); try { DerInputStream ticketStream = new DerInputStream(clientToken); DerValue[] values = ticketStream.getSet(clientToken.length, true);
privateKeyPem = privateKeyPem.replaceAll("\\s", ""); DerInputStream derReader = new DerInputStream(Base64.getDecoder().decode(privateKeyPem)); DerValue[] seq = derReader.getSequence(0); BigInteger modulus = seq[1].getBigInteger(); BigInteger publicExp = seq[2].getBigInteger(); BigInteger privateExp = seq[3].getBigInteger(); BigInteger prime1 = seq[4].getBigInteger(); BigInteger prime2 = seq[5].getBigInteger(); BigInteger exp1 = seq[6].getBigInteger(); BigInteger exp2 = seq[7].getBigInteger(); BigInteger crtCoef = seq[8].getBigInteger();
public static byte[] getDER(ObjectIdentifier id) throws IOException { if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE,"Returning OID in DER format"); _logger.log(Level.FINE," OID = " + id.toString()); } DerOutputStream dos = new DerOutputStream(); dos.putOID(id); byte[] oid = dos.toByteArray(); if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE," DER OID: " + dumpHex(oid)); } return oid; }
public static ObjectIdentifier getOID(byte[] derOID) throws IOException { DerInputStream dis = new DerInputStream(derOID); ObjectIdentifier oid = dis.getOID(); /* Note: getOID() method call generates an IOException * if derOID contains any malformed data */ return oid; }
private String expand(String value, boolean encodeURL) throws PropertyExpander.ExpandException { if (!expandProp) { return value; } else { return PropertyExpander.expand(value, encodeURL); } }
public X509Builder extKeyUsageServerAuth() { try { extKeyUsage(new ObjectIdentifier(serverAuthOidData)); } catch(Exception e) { fault(e, "extKeyUsageServerAuth"); } return this; }
@Override public FakeAWTPermission newPermission(String name) { return new FakeAWTPermission(name); } }
public String toString() { return "(\"java.awt.AWTPermission\" \"" + getName() + "\")"; } }
private static Permission newAWTPermission(String name) { return factory.newPermission(name); }
@Override public RSAPrivateKeySpec readPrivateKey(byte[] privateKeyDerBytes) throws IOException { sun.security.util.DerInputStream derStream = new sun.security.util.DerInputStream(privateKeyDerBytes); sun.security.util.DerValue[] derValues = derStream.getSequence(0); BigInteger modulus = derValues[1].getBigInteger(); BigInteger privateExponent = derValues[3].getBigInteger(); return new RSAPrivateKeySpec(modulus, privateExponent); }
public static byte[] getDER(ObjectIdentifier id) throws IOException { if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE,"Returning OID in DER format"); _logger.log(Level.FINE," OID = " + id.toString()); } DerOutputStream dos = new DerOutputStream(); dos.putOID(id); byte[] oid = dos.toByteArray(); if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE," DER OID: " + dumpHex(oid)); } return oid; }
public static ObjectIdentifier getOID(byte[] derOID) throws IOException { DerInputStream dis = new DerInputStream(derOID); ObjectIdentifier oid = dis.getOID(); /* Note: getOID() method call generates an IOException * if derOID contains any malformed data */ return oid; }
private String expand(String value, boolean encodeURL) throws PropertyExpander.ExpandException { if (!expandProp) { return value; } else { return PropertyExpander.expand(value, encodeURL); } }
public X509Builder extKeyUsageClientAuth() { try { extKeyUsage(new ObjectIdentifier(clientAuthOidData)); } catch(Exception e) { fault(e, "extKeyUsageClientAuth"); } return this; }
/** * Returns the (possibly expanded) keystore location, or null if the * expansion fails. */ public String getKeyStoreUrl() { try { if (keyStoreUrlString!=null && keyStoreUrlString.length()!=0) { return expand(keyStoreUrlString, true).replace (File.separatorChar, '/'); } } catch (PropertyExpander.ExpandException peee) { if (debug != null) { debug.println(peee.toString()); } return null; } return null; }
/** * Returns the (possibly expanded) keystore location, or null if the * expansion fails. */ public String getKeyStoreUrl() { try { if (keyStoreUrlString!=null && keyStoreUrlString.length()!=0) { return expand(keyStoreUrlString, true).replace (File.separatorChar, '/'); } } catch (PropertyExpander.ExpandException peee) { if (debug != null) { debug.println(peee.toString()); } return null; } return null; }