Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
野花太放肆
jenkins
提交
baa1dc5b
J
jenkins
项目概览
野花太放肆
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
baa1dc5b
编写于
4月 08, 2020
作者:
M
Matt Sicker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use standard Java Base64 class
Signed-off-by:
N
Matt Sicker
<
boards@gmail.com
>
上级
3f15ad20
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
10 deletion
+9
-10
core/src/main/java/hudson/cli/Connection.java
core/src/main/java/hudson/cli/Connection.java
+3
-3
core/src/main/java/hudson/console/ConsoleNote.java
core/src/main/java/hudson/console/ConsoleNote.java
+4
-5
core/src/main/java/jenkins/security/ResourceDomainConfiguration.java
...in/java/jenkins/security/ResourceDomainConfiguration.java
+2
-2
未找到文件。
core/src/main/java/hudson/cli/Connection.java
浏览文件 @
baa1dc5b
...
...
@@ -27,7 +27,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import
hudson.remoting.ClassFilter
;
import
hudson.remoting.ObjectInputStreamEx
;
import
hudson.remoting.SocketChannelStream
;
import
org.apache.commons.codec.binary.Base64
;
import
javax.crypto.Cipher
;
import
javax.crypto.CipherInputStream
;
...
...
@@ -56,6 +55,7 @@ import java.security.Signature;
import
java.security.interfaces.DSAPublicKey
;
import
java.security.interfaces.RSAPublicKey
;
import
java.security.spec.X509EncodedKeySpec
;
import
java.util.Base64
;
import
org.jenkinsci.remoting.util.AnonymousClassWarnings
;
/**
...
...
@@ -123,11 +123,11 @@ public class Connection {
}
public
void
writeKey
(
Key
key
)
throws
IOException
{
writeUTF
(
new
String
(
Base64
.
encodeBase64
(
key
.
getEncoded
()
)));
writeUTF
(
Base64
.
getEncoder
().
encodeToString
(
key
.
getEncoded
(
)));
}
public
X509EncodedKeySpec
readKey
()
throws
IOException
{
byte
[]
otherHalf
=
Base64
.
decodeBase64
(
readUTF
());
// for historical reasons, we don't use readByteArray()
byte
[]
otherHalf
=
Base64
.
getDecoder
().
decode
(
readUTF
());
// for historical reasons, we don't use readByteArray()
return
new
X509EncodedKeySpec
(
otherHalf
);
}
...
...
core/src/main/java/hudson/console/ConsoleNote.java
浏览文件 @
baa1dc5b
...
...
@@ -32,8 +32,6 @@ import jenkins.model.Jenkins;
import
hudson.model.Run
;
import
hudson.remoting.ObjectInputStreamEx
;
import
hudson.util.IOUtils
;
import
hudson.util.UnbufferedBase64InputStream
;
import
org.apache.commons.codec.binary.Base64OutputStream
;
import
org.apache.commons.io.output.ByteArrayOutputStream
;
import
org.apache.tools.ant.BuildListener
;
...
...
@@ -48,6 +46,7 @@ import java.io.Serializable;
import
java.io.Writer
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Base64
;
import
java.util.Collection
;
import
java.util.List
;
import
com.jcraft.jzlib.GZIPInputStream
;
...
...
@@ -204,7 +203,7 @@ public abstract class ConsoleNote<T> implements Serializable, Describable<Consol
ByteArrayOutputStream
buf2
=
new
ByteArrayOutputStream
();
try
(
DataOutputStream
dos
=
new
DataOutputStream
(
new
Base64OutputStream
(
buf2
,
true
,
-
1
,
null
)))
{
try
(
DataOutputStream
dos
=
new
DataOutputStream
(
Base64
.
getEncoder
().
wrap
(
buf2
)))
{
buf2
.
write
(
PREAMBLE
);
if
(
JenkinsJVM
.
isJenkinsJVM
())
{
// else we are in another JVM and cannot sign; result will be ignored unless INSECURE
byte
[]
mac
=
MAC
.
mac
(
buf
.
toByteArray
());
...
...
@@ -240,7 +239,7 @@ public abstract class ConsoleNote<T> implements Serializable, Describable<Consol
if
(!
Arrays
.
equals
(
preamble
,
PREAMBLE
))
return
null
;
// not a valid preamble
DataInputStream
decoded
=
new
DataInputStream
(
new
UnbufferedBase64InputStream
(
in
));
DataInputStream
decoded
=
new
DataInputStream
(
Base64
.
getDecoder
().
wrap
(
in
));
int
macSz
=
-
decoded
.
readInt
();
byte
[]
mac
;
int
sz
;
...
...
@@ -299,7 +298,7 @@ public abstract class ConsoleNote<T> implements Serializable, Describable<Consol
if
(!
Arrays
.
equals
(
preamble
,
PREAMBLE
))
return
;
// not a valid preamble
DataInputStream
decoded
=
new
DataInputStream
(
new
UnbufferedBase64InputStream
(
in
));
DataInputStream
decoded
=
new
DataInputStream
(
Base64
.
getDecoder
().
wrap
(
in
));
int
macSz
=
-
decoded
.
readInt
();
if
(
macSz
>
0
)
{
// new format
IOUtils
.
skip
(
decoded
,
macSz
);
...
...
core/src/main/java/jenkins/security/ResourceDomainConfiguration.java
浏览文件 @
baa1dc5b
...
...
@@ -33,7 +33,6 @@ import jenkins.model.Jenkins;
import
jenkins.model.JenkinsLocationConfiguration
;
import
jenkins.model.identity.InstanceIdentityProvider
;
import
jenkins.util.UrlHelper
;
import
org.apache.commons.codec.binary.Base64
;
import
org.jenkinsci.Symbol
;
import
org.kohsuke.accmod.Restricted
;
import
org.kohsuke.accmod.restrictions.Beta
;
...
...
@@ -50,6 +49,7 @@ import java.net.MalformedURLException;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.security.interfaces.RSAPublicKey
;
import
java.util.Base64
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
edu.umd.cs.findbugs.annotations.CheckForNull
;
...
...
@@ -158,7 +158,7 @@ public final class ResourceDomainConfiguration extends GlobalConfiguration {
// URL points to a Jenkins instance
RSAPublicKey
publicKey
=
InstanceIdentityProvider
.
RSA
.
getPublicKey
();
if
(
publicKey
!=
null
)
{
String
identity
=
Base64
.
encodeBase64
String
(
publicKey
.
getEncoded
());
String
identity
=
Base64
.
getEncoder
().
encodeTo
String
(
publicKey
.
getEncoded
());
if
(
identity
.
equals
(
identityHeader
))
{
return
FormValidation
.
ok
(
Messages
.
ResourceDomainConfiguration_ThisJenkins
());
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录