src/java.security.jgss/share/classes/sun/security/jgss/wrapper/NativeGSSFactory.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package sun.security.jgss.wrapper; |
26 package sun.security.jgss.wrapper; |
27 |
27 |
28 import java.io.UnsupportedEncodingException; |
|
29 import java.security.Provider; |
28 import java.security.Provider; |
30 import java.util.Vector; |
29 import java.util.Vector; |
31 import org.ietf.jgss.*; |
30 import org.ietf.jgss.*; |
32 import sun.security.jgss.GSSUtil; |
31 import sun.security.jgss.GSSUtil; |
33 import sun.security.jgss.GSSCaller; |
32 import sun.security.jgss.GSSCaller; |
34 import sun.security.jgss.GSSExceptionImpl; |
33 import sun.security.jgss.GSSExceptionImpl; |
35 import sun.security.jgss.spi.*; |
34 import sun.security.jgss.spi.*; |
|
35 |
|
36 import static java.nio.charset.StandardCharsets.UTF_8; |
36 |
37 |
37 /** |
38 /** |
38 * JGSS plugin for generic mechanisms provided through native GSS framework. |
39 * JGSS plugin for generic mechanisms provided through native GSS framework. |
39 * |
40 * |
40 * @author Valerie Peng |
41 * @author Valerie Peng |
78 cStub = GSSLibStub.getInstance(mech); |
79 cStub = GSSLibStub.getInstance(mech); |
79 } |
80 } |
80 |
81 |
81 public GSSNameSpi getNameElement(String nameStr, Oid nameType) |
82 public GSSNameSpi getNameElement(String nameStr, Oid nameType) |
82 throws GSSException { |
83 throws GSSException { |
83 try { |
84 byte[] nameBytes = |
84 byte[] nameBytes = |
85 (nameStr == null ? null : nameStr.getBytes(UTF_8)); |
85 (nameStr == null ? null : nameStr.getBytes("UTF-8")); |
86 return new GSSNameElement(nameBytes, nameType, cStub); |
86 return new GSSNameElement(nameBytes, nameType, cStub); |
|
87 } catch (UnsupportedEncodingException uee) { |
|
88 // Shouldn't happen |
|
89 throw new GSSExceptionImpl(GSSException.FAILURE, uee); |
|
90 } |
|
91 } |
87 } |
92 |
88 |
93 public GSSNameSpi getNameElement(byte[] name, Oid nameType) |
89 public GSSNameSpi getNameElement(byte[] name, Oid nameType) |
94 throws GSSException { |
90 throws GSSException { |
95 return new GSSNameElement(name, nameType, cStub); |
91 return new GSSNameElement(name, nameType, cStub); |